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