#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

double a, b, x, y;
int main() {
  cin >> a >> b >> x >> y;
  cout << fixed << setprecision(15) << (a + b) * min(x / a, y / b) << endl;
  return 0;
}