#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int i, j; double a, b, x, y; cin >> a >> b >> x >> y; if (a > b) { while (true) { double num = x * (b / a); if (num <= y) { y = num; break; } else { x--; } } } else { while (true) { double num = y * (a / b); if (num <= x) { x = num; break; } else { y--; } } } cout << fixed << y + x << endl; getchar(); getchar(); return 0; }