from math import gcd A, B = map(int, input().split()) G = gcd(A + B, A * B) print(G)