def factors(X: int): assert X >= 1 F: list[tuple[int, int]] = [] d = 2 while d*d <= X: e = 0 while X%d == 0: e += 1 X //= d if e > 0: F.append((d, e)) d += 1 if X > 1: F.append((X, 1)) return F from fractions import Fraction A, B = map(Fraction, input().split()) def solve(A, B): p, q = A.as_integer_ratio() if q != 1: return False x, y = B.as_integer_ratio() for _, e in factors(A): if Fraction(e*p, y).as_integer_ratio()[1] != 1: return False return True ans = solve(A, B) if ans == True: print("Yes") elif ans == False: print("No") else: raise