def gcd(x,y) while y != 0 r = x% y x=y y=r end x end a.b=gets.split.map &:to_i p gcd(a+b,a*b)