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