def gcd(m,n) n,m=m,n if m < n while n > 0 m,n = n,m % n end return m end a,b = gets.split.map(&:to_i) _s = a+b _p = a*b p gcd(_s,_p)