#include #include #include using namespace std; const double MAX_TIME = 10000; const double EXTEND_SPEED = 200; const int XSIZE = 1024; const int YSIZE = 768; double calc(int rx, int ry, vector &ax, vector &ay, vector &avx, vector &avy, int xsize, int ysize) { vector > ival; double et=(ry>?(ysize-ry))/EXTEND_SPEED; int n=ax.size(); for(int i=0;iMAX_TIME) stop=true; double y=fmod(ay[i]+avy[i]*t,2*ysize); if (y<0) y+=2*ysize; if (y>=ysize) y=2*ysize-y; double ct=fabs(y-ry)/EXTEND_SPEED; if (et>=ct+1e-9 && t>=ct-1e-9) { ival.push_back(make_pair(t-et,true)); ival.push_back(make_pair(t-ct,false)); } d[k]+=xsize*2; } } sort(ival.begin(), ival.end()); if (ival.size()==0 || ival[0].first>=-1e-9) return 0; int cnt=0; for(int i=0;i> n; if (n==0) return false; cin >> rx >> ry; vector ax(n), ay(n), avx(n), avy(n); for(int i=0;i> ax[i] >> ay[i] >> avx[i] >> avy[i]; double t1=calc(rx,ry,ax,ay,avx,avy,XSIZE,YSIZE); double t2=calc(ry,rx,ay,ax,avy,avx,YSIZE,XSIZE); double t=t1MAX_TIME) printf("Never\n"); else printf("%0.5lf\n",t); return true; } int main() { while (solve()); return 0; }