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): if B == 0: return True if B > 0: p, q = A.as_integer_ratio() if q != 1: return False x, y = B.as_integer_ratio() for _, e in factors(A): g = Fraction(e*x, y) if g.as_integer_ratio()[1] != 1 or g < 0: return False if B < 0: return solve(1/A, -B) return True ans = solve(A, B) if ans == True: print("Yes") elif ans == False: print("No") else: raise