#include /* x(t+1)=x(t)-y(t)*w+x(t)*v y(t+1)=y(t)+x(t)*w+y(t)*v x(t+1)=x(t)*(1+v)-y(t)*w y(t+1)=y(t)*(1+v)+x(t)*w x(t+1)*(1+v)=x(t)*(1+v)*(1+v)-y(t)*w*(1+v) y(t+1)*w=y(t)*w*(1+v)+x(t)*w*w x(t+1)*(1+v)+y(t+1)*w=x(t)*((1+v)*(1+v)+w*w) x(t+1)*w=x(t)*w*(1+v)-y(t)*w*w y(t+1)*(1+v)=y(t)*(1+v)*(1+v)+x(t)*w*(1+v) y(t+1)*(1+v)-x(t+1)*w=y(t)*((1+v)*(1+v)+w*w) */ int main(void) { int n; scanf("%d", &n); while (n--) { int t; scanf("%d", &t); double p, w, v, gx, gy, ux, uy, z; scanf("%lf%lf%lf%lf%lf", &p,&w,&v,&gx,&gy); z = (1.0+v)*(1.0+v) + w*w; if (t > 1 && z != 0.0) { for (int i=1; i