def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) return arr A, B = input().split() A1, A2 = A.split(".") B1, B2 = B.split(".") flag = 1 if B1[0] == "-": flag = 0 A1, A2, B1, B2 = int(A1), int(A2), int(B1), int(B2) if flag: if B1 == 0 and B2 == 0: print("Yes") exit() if A2: print("No") exit() if B2 == 0: print("Yes") exit() L = factorization(A1) for a, v in L: if v * (B1 * 10000 + B2) % 10000: print("No") exit() print("Yes") else: top = 10000 down = 10000 * A1 + A2 if top % down: print("No") exit() A1 = top // down L = factorization(A1) for a, v in L: if v * (B1 * 10000 + B2) % 10000: print("No") exit() print("Yes")