import math a, b = map(int, input().split()) g = math.gcd(a, b) a_prime = a // g b_prime = b // g sum_prime = a_prime + b_prime d = math.gcd(g, sum_prime) print(g * d)