Lucy asked Huang Bo a question, “You have two 2-D point A and B, please calculate how many integer points in segment A, B. For example, A(1, 3), B(3, 1) only has 1 integer point (2, 2)”.
Lucy asked Huang Bo a question, “You have two 2-D point A and B, please calculate how many integer points in segment A, B. For example, A(1, 3), B(3, 1) only has 1 integer point (2, 2)”.
There are multiple test cases (less than 1000), for each test, there will be one line contain four integers ax, ay and bx, by, represent the point A and B
Notice that the absolute value of integer is 109.
One line for each test case, write the number of integer point.
1 3 3 1
1 11 5 3
1 1 9 9
1
3
7
Bonus Problem. Math