import fractions A, B = map(int,input().split()); print(fractions.gcd(A+B,A*B));