A,B=input().split()
x=int(A[:-5]+A[-4:])
y=10000
z=int(B[:-5]+B[-4:])
w=10000
if z==0:
	print("Yes")
	exit()
if z<0:
	x,y=y,x
	z=-z
if x%y!=0:
	print("No")
	exit()
ans="No"
A=x//y
if A==1:
	print("Yes")
	exit()
for i in range(2,200000):
	x=0
	a=A
	while a%i==0:
		a//=i
		x+=1
	if a!=1:
		continue
	if (x*z)%w==0:
		ans="Yes"
print(ans)