#P59. [KBC005C] Segment
[KBC005C] Segment
Source
This problem is adapted from Long Long OJ. All rights reserved.
Problem Description
Given two endpoints and of a line segment on a plane, find the number of points on this line segment (excluding the endpoints) where both the -coordinate and -coordinate are integers.
Input Format
This problem contains multiple test cases.
For each test case, input a line with four integers $x_1,y_1,x_2,y_2\ (-10^9\le x_1,x_2,y_1,y_2\le 10^9)$ separated by spaces.
The input ends with EOF.
It is guaranteed that the number of input test cases does not exceed .
Output Format
For each test case, output a line consisting of a non-negative integer representing the answer.
Samples
1 11 5 3
114 514 114 514
3
0