Given two Arithmetic Progressions, A1=ax+b and A2=cy+d, that is we're given a, b ,c & d (where a, b, c, & d all are positive integers) how have to find minimum value of |A1-A2| by choosing x and y (where x & y are also positive integers) which minimizes the absolute difference between A1 and A2.
for example - if a=7, b=1, c=4 & d=5 then min(|A1-A2|)=0 by choosing x=4 and y=6
Don't answer .It's Question of Running contest on Codechef link