import math a,b=map(int,input().split()) m=a*b p=a+b print(math.gcd(m,p))