#include int main(){ double v1,v2,d,w; scanf("%lf %lf %lf %lf",&v1,&v2,&d,&w); double total=0; double touch=0; int direction=0; while(d>0.000001){ if(direction==0){//右向き touch=w*d/(w+v2);//蜂が右の車にぶつかるまでの距離 // printf("%lf\n",touch); total+=touch; d-=(v1+v2)*d/(w+v2);//左右の車が動いた距離を減らす // printf("total=%lf nokori=%lf\n",total,d); direction=1; }else{//左向き touch=w*d/(w+v1); // printf("%lf\n",touch); total+=touch; d-=(v1+v2)*d/(w+v1); // printf("total=%lf nokori=%lf\n",total,d); direction=0; } } printf("%f\n",total); return 0; }