Олимпиадный тренинг

Задача 24761. road to nowhere


Задача

Темы:
Kolobok has a strange dream.
In it, Gingerbread Man is on a checkered field of size n × m in a cell with coordinates (x, y).
Initially, Gingerbread Man looks along the positive direction of the X axis. Then he starts walking across the field with the following pattern:
x Move forward one cell. Rotate 90o to the right.
x Move forward one cell. Rotate 90o to the right.
x Move forward two squares. Rotate 90o to the right.
x Move forward two squares. Rotate 90o to the right.
x Move forward three squares. Rotate 90o to the right.
x Move forward three squares. Rotate 90o to the right.
x Move forward four squares. Rotate 90o to the right.
x And so on...

The movement continues until Kolobok leaves the field. After that, Kolobok wakes up.

In the morning Kolobok decided to analyze his dream. He guessed that he was in each cell at most once, but he can't remember how many cells he visited. Kolobok asks you to write a program that will count the number of cells he has visited.




Input file format
The first line of the input file contains two natural numbers n, m (1 ≤ n, m ≤ 109 ) — board dimensions along the x-axis and y-axis respectively. The second line contains two natural numbers x, y (1 ≤ x ≤ n; 1 ≤ y ≤ m) — coordinates of the starting position of the kolobok.

Output file format
In the output file print a single number — the number of cells visited by Kolobok in his sleep.

Output Enter
76
3 4
36
2 2
1 1
2
2 2
1 2
4

Comment
The figure clearly shows the first example.