## Problem I. Inner triangles ≡

• problems
 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

0 ≤ a + b + c + d ≤ 1000

### Sample tests

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

0.095s 0.014s 15