A, B = input().split() if A[-4:] != "0000": exit(print("No")) a, _ = A.split(".") a = abs(int(a)) if a == 1: exit(print("Yes")) if B[0] == "-": exit(print("No")) _, b = B.split(".") b = int(b) if b == 0: exit(print("Yes")) if 10000%b != 0: print("No") else: n = 10000//b if n > 60: print("No") else: left = 0 right = 1000 while left+1 < right: mid = (left+right)//2 if mid**n <= a: left = mid else: right = mid if left**n == a: print("Yes") else: print("No")