AB = list(map(int,input().split())) sumAB = sum(AB) kake = AB[0]*AB[1] def f(a,b): while b: a, b = b, a % b return a print(f(sumAB,kake))