a, b, x, y = map(int, input().split()) ys = x * b / a if ys <= y: res = x + ys xs = y * a / b if xs <= x: res = xs + y print(res)