#include #include #include using namespace std; int main() { double vl, vr, d, w; cin >> vl >> vr >> d >> w; double dist = 0; double l = 0, r = d; while (l < r - 0.00000001) { double cnt; if (w > 0) cnt = (r - l) / (w + vr); else cnt = (r - l) / (vl - w); dist += cnt*abs(w); l += cnt*vl; r -= cnt*vr; w = -w; } cout << fixed << setprecision(8) << dist << endl; return 0; }