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