#include #include using namespace std; int main(){ double a,b,x,y; cin >> a >> b >> x >> y; cout << min(x,y / b * a) + min(y,x / a * b) << endl; }