#include using namespace std; int MAIN() { double a, b, c, d; cin >> a >> b >> c >> d; c = min(c, d / b * a); d = min(d, c / a * b); c = min(c, d / b * a); d = min(d, c / a * b); cout << (c + d) << endl; return 0; } int main() { int start = clock(); #ifdef LOCAL_TEST freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif ios :: sync_with_stdio(false); cout << fixed << setprecision(16); int ret = MAIN(); #ifdef LOCAL_TEST cout << "[Finished in " << clock() - start << " ms]" << endl; #endif return ret; }