Carrot Dreams#654

Carrot Dreams

1 second
64 megabytes
Very easy

John works for a company called "FIELD-Tech," and today he was so exhausted after work that he fell asleep as soon as he got home. Unfortunately, even in his dreams, he can't escape thoughts of his job. In one dream, a company that grows carrots posed an unusual question to him: How many carrots grow on a non-zero segment connecting two given carrots? The ends of the segment (i.e., the two given carrots) should not be counted. The company's representatives (people with carrots for heads) explained that all carrots grow in an infinite field, with exactly one carrot at each point with integer coordinates. You need to help the tired John solve this problem.

Input

You are given a single line containing four non-negative integers x_1, y_1, x_2, y_2 – the coordinates of two carrots. (0 \leq x_1, y_1, x_2, y_2 \leq 50).

Output

Output a single integer – the number of carrots that lie strictly on the segment connecting the two given carrots.

Examples

Example 1

Loading
Loading