from math import* a,b=input().split() al,ar=map(int,a.split('.')) bl,br=map(int,b.split('.')) def pf(n): a,f={},2 while f*f<=n: if n%f:f+=1 else:a[f]=a.get(f,0)+1;n//=f if n>1:a[n]=a.get(n,0)+1 return a a=al*10000+ar ag=gcd(a,10000) a//=ag aq=10000//ag b=bl*10000+br bg=gcd(b,10000) b//=bg bq=10000//bg if b<0: b,bg=bg,-b if aq==bq==1: exit(print('Yes')) pa=pf(a) for k,v in pa.items(): if v*b%bq: exit(print('No')) paq=pf(aq) for k,v in paq.items(): if pa[k]