#include<stdio.h>
#include<math.h>
#include<string.h>
double first(double vx,double vy,double h) {
return vx*(vy+sqrt(vy*vy+19.6*h))/9.8;
}
double nowh(double h,double vy,double t) {
return h+vy*t-4.9*t*t;
}
int main() {
double k,h,vx,vy,v1,v2,v3,h1,h2,t;
char s[30];
while(scanf("%lf%s",&h,s)!=EOF) {
if(strcmp(s,"Red")==0) {
scanf("%lf%lf",&vx,&vy);
printf("%.3f
",first(vx,vy,h));
continue;
}
if(strcmp(s,"Yellow")==0) {
scanf("%lf%lf%lf",&vx,&vy,&t);
if(first(vx,vy,h)<vx*t) {
printf("%.3f
",first(vx,vy,h));
continue;
}
h1=nowh(h,vy,t);
h2=vx*t;
vy=vy-9.8*t;
printf("%.3f
",h2+first(2*vx,2*vy,h1));
continue;
}
if(strcmp(s,"Blue")==0){
scanf("%lf%lf%lf%lf%lf%lf",&vx,&vy,&t,&v1,&v2,&v3);
if(first(vx,vy,h)<vx*t) {
printf("%.3f
",first(vx,vy,h));
continue;
}
h1=nowh(h,vy,t);
h2=vx*t;
vy=vy-9.8*t;
printf("%.3f %.3f %.3f
",h2+first(v1,vy,h1),h2+first(v2,vy,h1),h2+first(v3,vy,h1));
}
}
return 0;
}
//一个博客地址帮助你理解http://blog.sina.com.cn/s/blog_c0519a300101dr2w.html