import math as m A, B = map(int, input().split()) print(m.gcd(A+B, A*B))