from fractions import Fraction def solve(a: Fraction, b: Fraction) -> bool: if b == 0: return True if b < 0: a = 1 / a b = -b if not a.is_integer(): return False ok = a.numerator ng = 0 while ok - ng > 1: mid = (ok + ng) // 2 if mid**b.denominator >= a: ok = mid else: ng = mid return ok**b.denominator == a.numerator a, b = map(Fraction, input().split()) print("Yes" if solve(a, b) else "No")