import sys input = sys.stdin.readline import math X,A,Y,B=map(int,input().split()) # 素因数分解 def fac(x): L=int(math.sqrt(x)) FACT=dict() for i in range(2,L+2): while x%i==0: FACT[i]=FACT.get(i,0)+1 x=x//i if x!=1: FACT[x]=FACT.get(x,0)+1 return FACT FX=fac(X) FY=fac(Y) flag=1 for fx in FX: if fx in FY and FX[fx]*A