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