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