from math import gcd a,b = input().split() if b==0: exit(print("Yes")) if a[-4:]!="0000": exit(print("No")) a = int(a[:-5]); b = int(b[:-5]+b[-4:]); c = 10000 d = gcd(b,c); b //= d; c //= d for i in range(1,a+1): if i**c==a: exit(print("Yes")) if i**c>a: break print("No")