from fractions import Fraction def gcd(a,b): if b==0: return a else: return gcd(b,a%b) A,B=list(map(str,input().split())) if B=="0.0000": print("Yes") exit() if B[0]=="-": print("No") exit() a="" for i in range(len(A)): if A[i]!=".": a=a+A[i] a=int(a) b="" for i in range(len(B)): if B[i]!=".": b=b+B[i] b=int(b) aa=Fraction(a,10000) bb=Fraction(b,10000) if aa.denominator!=1: print("No") exit() c=aa.numerator d=c cnt=[] for i in range(2,int(d**0.5)+5): if c%i==0: z=0 while c%i==0: c=c//i z+=1 cnt.append(z) if len(cnt)==1: if cnt[0]%bb.denominator==0: print("Yes") exit() else: print("No") exit() else: m=cnt[0] for i in range(1,len(cnt)): m=gcd(max(m,cnt[i]),min(m,cnt[i])) if m%bb.denominator==0: print("Yes") exit() else: print("No") exit()