from math import gcd as g a,b=map(int,input().split()) print(g(a+b,a*b))