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