e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

The Segment

The Segment

prb136.gif The segment's end points have integer coordinates. Find the number of points on a segment with integer coordinates.

Input

Four numbers - the coordinates x1, y1, x2, y2 of the segment ends. All numbers are not greater than 2۰109 by absolute value.

Output

Print the number of points on a segment with integer coordinates.

Time limit 1 second
Memory limit 128 MiB
Input example #1
0 0 3 3
Output example #1
4
Input example #2
2 1 6 3
Output example #2
3