Pruge
A pattern composed of dark stripes (as depicted in the figure below) spans the entire first quadrant in the rectangular coordinate system.
InputThe first and only line of input contains four integers X1, Y1, X2 and Y2 – the coordinates of the rectangle with the lower left corner in (X1,Y1) and upper right corner in (X2,Y2). 0 ≤ X1 < X2 ≤ 1 000 000, 0 ≤ Y1 < Y2 ≤ 1 000 000.
OutputThe first and only line of output should contain a single integer – the total number of dark squares inside the given rectangle.
Note: use the 64-bit signed integer type (int64 in Pascal, long long in C/C++).
Note: use the 64-bit signed integer type (int64 in Pascal, long long in C/C++).
Input
2 3 7 6
Output
8
Submit solution
Sign in to submit a solution.