def gcd(a, b): while (a != 0) : c = a a = b%a b = c return b A, B = map(int,input().split()) print(gcd(A + B,A * B))