from math import gcd A, B = map(int, input().split()) g = gcd(A, B) ans = g * gcd(A//g + B//g, g) print(ans)