The software used in the Algorithm Busters competition is the work of Tomek W. This year, Tomek M. is in charge of it. Tomek M. is trying very hard to ensure the competition runs flawlessly. This is why Tomek has been having nightmares lately. Yesterday, he dreamed that he was a knight jumping on an infinite chessboard. The moves the knight can make are described by two pairs of integers: $(a, b)$ and $(c, d)$ — a knight standing on square $(x, y)$ can move to square $(x + a, y + b)$, $(x - a, y - b)$, $(x + c, y + d)$, or $(x - c, y - d)$. Tomek wondered (in his dream, of course) for which square $(x, y)$ other than $(0, 0)$, which he can reach starting from $(0, 0)$ (possibly in many jumps), the value $|x| + |y|$ is the smallest. Tomek woke up drenched in sweat because he could not solve this problem and did not know if he would wander so far from the point $(0, 0)$ that he would not have time to prepare the final round of the Algorithm Busters.
Task
Your task is to write a program that:
- reads from standard input two pairs of integers $(a, b)$ and $(c, d)$, not equal to $(0, 0)$, describing the knight's moves,
- determines a pair of integers $(x, y)$ other than $(0, 0)$ that the knight can reach (possibly in many jumps) from $(0, 0)$ and for which the value $|x| + |y|$ is the smallest,
- writes the value $|x| + |y|$ to standard output.
Input
The first line of standard input contains four integers: $a$, $b$, $c$, and $d$, where $-100\,000 \le a, b, c, d \le 100\,000$.
Output
Your program should write to standard output, in the first and only line, a single integer equal to $|x| + |y|$.
Examples
Input 1
13 4 17 5
Output 1
2