def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: while temp%i==0: temp //= i arr.append(i) if temp!=1: arr.append(temp) if arr==[]: arr.append(n) return arr x,a,y,b=map(int,input().split()) xlis=factorization(x) ylis=factorization(y) if len(set(xlis) & set(ylis))==len(ylis): print("Yes") else: print("No")