#include using namespace std; int main(){ int A, B, X, Y; double diviAB, diviBA; cin >> A >> B >> X >> Y; diviAB = (double)A/B; diviBA = (double)B/A; if(A == B){ if(X <= Y){ cout << 2*X << endl; }else{ cout << 2*Y << endl; } return 0; }else if(A*Y >= X*B){ //cout << X + diviBA*X << endl; printf("%.7f\n", X + diviBA*X); }else{ //cout << Y + diviAB*Y << endl; printf("%.7f\n", Y + diviAB*Y); } return 0; }