import math x,a,y,b=map(int,input().split()) c=pow(x,a) d=pow(y,b) if math.gcd(c,d)==1: print("No") else: print("Yes")