a,b,x,y=map(int,input().split()) m=min(x/a,y/b) print(m*(a+b))