import sys input = sys.stdin.readline from fractions import Fraction eps=0.00000000001 A,B=input().split() A=Fraction(A) B=Fraction(B) if B<0: B=-B A=1/A if B>5: B-=int(B)-1 x=A**B if abs(round(x)-x)>=eps: print("No") exit() x=A.numerator y=A.denominator z=B.numerator w=B.denominator #print(A,B,x,y,z,w) flag=0 u=x**(1/w) v=y**(1/w) if round(u)**w==x: flag+=1 if round(v)**w==y: flag+=1 if flag==2: A=Fraction(round(u)/round(v)) B=B*w if A.denominator==1: print("Yes") else: print("No") else: print("No")