import fractions lst = raw_input().split() lst = map(int,lst) print (str(fractions.gcd(lst[0]*lst[1], lst[0]+lst[1])))