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