SPEED  Circular Track
Two persons are running on a circular track either in the same direction or in the opposite direction, indefinitely. The speed of both of them is given to you. Speed will be positive in clockwise direction, and negative in anticlockwise direction. Print the number of distinct points, at which they will meet on the circle.
Input
First line contains T, number of test cases. Each test case contains two integers, S1 and S2 (not equal to zero) which are the speeds of the two persons. S1 and S2 will be distinct.
Edited: All the numbers fit in signed 32bit integer.
Output
Print in a separate line, the number of distinct points at which they meet.
Example
Input 2 1 2 1 1 Output 1 2
hide comments
a_l_o_n_e:
20190904 15:44:25
AC in one go 0.00 s 

pandey101299:
20190402 15:38:01
only gcd and relative motion apply


satish18:
20190126 18:13:10
30th 

vivek_dwivedi:
20180703 07:26:08
do these type of questions when you need confidence !


raichu7:
20170822 19:43:30
AC in one go :) 

kooljais24:
20170619 23:23:26
AC in one go....my 100th 

viratian_070:
20170617 16:43:18
just observe....very nice problem.... 

ankit1cool:
20170613 15:43:49
Those getting WA check that when both s1 and s2 is negative then they are in same direction 

vanvinhbk94:
20170224 04:18:01
AC in one go :)) 

sushantoberoi3:
20161031 07:04:50
good question!! 
Added by:  Nikunj Jain 
Date:  20110721 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 