#include #define rep(i,n) for(int i = 0; i < (n); ++i) typedef long long ll; using namespace std; const double eps = 1e-9; int main() { long double tf, vf, hf, td, vd, hd, backup_tf; cin >> tf >> vf >> hf >> td >> vd >> hd; //cout << endl << " " << tf << " " << vf << " " << hf << " " << td << " " << vd << " " << hd << endl; backup_tf = tf; td -= tf; tf = 0; long double t_fall = sqrt(2*hf); long double tj = sqrt(2.0/3.0*hd); if (vf >= vd){ //cout << "fast" << endl; cout << setprecision(15) << 2*(t_fall*vf)/vd + td + backup_tf << endl; return 0; } long double t_samex = (vd*td)/(vd-vf); //cout << "t_fall " << t_fall << " tj " << tj << " t_samex " << t_samex << endl; if(t_samex > t_fall) { //cout << "s > f"<< endl; cout << setprecision(15) << 2*(t_fall*vf)/vd + td + backup_tf << endl; return 0; } if (t_samex >= tj) { //cout << "s >= tj" << endl; if ((hf - 0.5*t_samex*t_samex) <= hd) { //cout << "1rr" << endl; cout << setprecision(15) << 2*t_samex - td + backup_tf << endl; return 0; } //cout << "2rr" << endl; long double t_hd = sqrt(2*(hf-hd)); cout << setprecision(15) << t_hd + vf*t_hd/vd + backup_tf << endl; return 0; } //cout << "bs" << endl; long double l = 0; long double r = tj; while(r-l > eps) { long double mid = (r+l)/2.0; long double yf = hf - 0.5*(mid+td)*(mid+td); long double ypes = hd - 1.5*(tj-mid)*(tj-mid); if(yf < ypes) r = mid; else l = mid; } l = max(l+td, t_samex); cout << setprecision(15) << l + l*vf/vd + backup_tf << endl; return 0; }