The Segment
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
The endpoints of the segment have integer coordinates. Count the number of points on the segment with integer coordinates.
Input
Four integers represent the coordinates of the endpoints of the segment. The coordinate values do not exceed in absolute value.
Output
Print the number of points on the segment with integer coordinates.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 14K
Acceptance rate 29%