#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 separated by spaces.
The input ends with EOF.
Output Format
For each test case, output a line containing the answer.
Samples
1 11 5 3
114 514 114 514
3
0
Data Range
For of the data: , and the number of input test cases does not exceed .