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