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