from sys import exit from collections import defaultdict def Prime_factorization(x): result=defaultdict(int) if x==1: result[1]=1 return result i=2 while(i**2<=x): tmp=0 while(x%i==0): tmp+=1 x//=i if tmp>0: result[i]=tmp i+=1 if x>1: result[x]=1 return result x,a,y,b=map(int,input().split()) X=Prime_factorization(x) Y=Prime_factorization(y) for q,i in Y.items(): if X[q]*a