#define _USE_MATH_DEFINES //M_PI(π),M_SQRT2(√2) #include //std::cout, std::cin #include //std::string,std::to_string(C++11) #include //std::vector #include //std::valarray #include //std::sort #include //localtime_s #include //abs #include //abs,std::pow,sqrt,sin,cos,round,floor,ceil #include //std::ifstream,std::ofstream #include //std::setprecision,std::setw,std::setfill #include //std::random(C++11) #include //std::accumulate int main(void) { //test用 //std::ifstream in("test.txt"); //std::cin.rdbuf(in.rdbuf()); //const unsigned int MODULO = 1000000007; //MODULO 10^9+7用 double A, B, X, Y; std::cin >> A >> B >> X >> Y; double i = 1, ans = 0; if (A < B) { while (i <= Y && i*A / B <= X) { i++; } ans = (i - 1) + ((i - 1)*A / B); } else { while (i <= X && i*B / A <= Y) { i++; } ans = (i - 1) + ((i - 1)*B / A); } std::cout << std::fixed << std::setprecision(10) << ans << std::endl; }