import sys readline=sys.stdin.readline from math import gcd as GCD A,B=map(int,readline().split()) ans=GCD(A+B,A*B) print(ans)