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