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