sa,sb=input().split()

na,ma=int(sa[:sa.index(".")]),int(sa[sa.index(".")+1:])

nb,mb=int(sb[:sb.index(".")]),int(sb[sb.index(".")+1:])

if mb==0 and nb==0:
    print("Yes")
    exit()

if na==1 and mb==0:
    print("Yes")
    exit()

if sb[0]=="-":
    if na>0:
        print("No")
        exit()
    
    t=len(sa)-sa.index(".")-1
    v=10**t

    # print(v,ma)

    if v%ma:
        print("No")
        exit()
    
    na=v//ma
    ma=0

if ma!=0:
    print("No")
    exit()

x=-1
y=-1

for i in range(2,na+1):
    now=na
    cnt=0

    while now%i==0:
        now//=i
        cnt+=1
    
    if now!=1:continue
    
    if y<cnt:
        x=i
        y=cnt

if (mb*y)%10000:
    print("No")
else:
    print("Yes")