#include using namespace std; using ll = long long; int main(){ double a,b,x,y; cin >> a >> b >> x >> y; cout << fixed << setprecision(15); if(a*y == b*x){ cout << x + y << endl; }else{ cout << min((a+b)*(x/a),(a+b)*(y/b)) << endl; } return 0; }