Loading [MathJax]/jax/output/CommonHTML/jax.js

Problem I. Inner triangles

Author:A. Karabanov   Time limit:1 sec
Input file:Standard input   Memory limit:64 Mb
Output file:Standard output  

Statement

Timofey was sitting on a math test. His test was completed, he even solved the test of his neighbour, beautiful Alena. Timofey was bored, so he started to draw on checkered sheet of paper.

At first, he drew a square with lines, parallel to sheet sides, and marked all vertices of this square. Then he marked additional a points on the first side of square, b additional points on second side of the square, c additional points on the third side and d aaditional points on the last side. Now he is interested, how many different nondegenerate triangles with vertices in marked points are there?

Input format

The only line of input contains four space-separated natural numbers: a, b, c ї d.

Output format

Print one integer — number of different nondegenerate triangles with vertices in marked points.

Constraints

0a+b+c+d1000

Explanation of the first sample

Sample tests

No. Standard input Standard output
1
1 0 0 0
9
2
1 2 3 4
329

0.086s 0.022s 15