0 0 10 10
1
10 0 0 1.57079
0
 -88 -68 -10 -61
5
-64 -55 3.09648 0.28346
-8 -52 2.46781 0.13262
-8 -59 3.02445 0.00119
-40 90 2.37292 0.15686
-29 -34 2.73957 0.18287
0
 0 0 10 10
2
10 0 0 1.57079
10 5 0 0.7854
1
 -100000 -100000 100000 100000
1
100000 0 0 15.70796
0
 -3 -7 -14 2
5
-16 19 2.12587 0.30781
9 -19 3.27418 0.06595
-1 12 0.12414 8.82294
20 10 6.25657 0.77605
-10 17 0.29502 6.31019
5

14.142079
 7.216642
 7.071084
 2828426.5363
 0.0000

#include <stdio.h>
#include <tchar.h>
#include<cmath>
#include<valarray>
#include<algorithm>
#include<functional>
#include<list>
#include<vector>
#include<map>
#include<iostream>

using namespace std;

typedef pair<double,double> Para;

int N;
int K;
Para A;
Para B;
const double pi=3.141592653589;

valarray<double> tanks;

double rad(Para p1, Para p2);
double cosinus(Para,Para,Para);
Para ortohonal(Para p);

void Init();
double MakeSolution();



int _tmain(int argc, _TCHAR* argv[])
{
    //::freopen("stdin.txt","r",stdin);
    Init();
    double V=MakeSolution();
    printf("%.4lf\n",V);
    return 0;
}

void Init()
{
    double v1,v2,v3,x,y,alfa,w;
    cin>>x>>y; A=make_pair(x,y);
    cin>>x>>y; B=make_pair(x,y);
    cin>>N;
    tanks.resize(N);
    double D=sqrt(pow(B.first-A.first,2)+pow(B.second-A.second,2));
    Para p;
    for(int i=0;i<N;i++)
    {
        cin>>p.first>>p.second;
        cin>>alfa>>w;
        double a1=rad(p,A);
        a1=abs(alfa-a1);
        double a2=rad(p,B);
        a2=abs(alfa-a2);
        a1=min(a1,2*pi-a1);
        a2=min(a2,2*pi-a2);
        v1=(D*w)/a2;
        Para M=ortohonal(p);
        double t1=a1/w;
        double c=cosinus(M,p,A);
        double t2=acos(c)/w; 
        t2+=t1;
        double c1=pow(cos(t1*w),2);
        double c2=pow(cos(t2*w),2);
        double l=sqrt(pow(M.second-p.second,2)+pow(M.first-p.first,2));
        v2=l*w*(c2-c1)/((c1*c2)*t2);
        double j=acos(cosinus(A,p,B));
        v3=D/(t1+(j)/w);
        tanks[i]=max(v1,max(v2,v3));
    }
    sort(&tanks[0],&tanks[N],std::greater<double>());
    cin>>K;
}

double MakeSolution()
{
    if(K==N) return 0;
    for(int i=K;i>0;i--)
    {
        if(tanks[i]!=tanks[i-1]) return tanks[i];
    }
    return tanks[0];
}

double rad(Para p1, Para p2)
{
        double x=(p2.second-p1.second)/(p2.first-p1.first);
        double q=atan(abs(x));
        x=(x<0)? pi-q:q;
        double h=p2.second-p1.second;
        if(h<0) return pi+x;
        if(h==0)return (p2.first>p1.first)?0:pi;
        return x;
}

double cosinus(Para p1,Para p0,Para p2)
{
    double d1=sqrt(pow(p1.first-p0.first,2)+pow(p1.second-p0.second,2));
    double d2=sqrt(pow(p2.first-p0.first,2)+pow(p2.second-p0.second,2));
    double t=((p1.first-p0.first)*(p2.first-p0.first)+(p1.second-p0.second)*(p2.second-p0.second))/(d1*d2);
    return t;
}

Para ortohonal(Para p)
{
    double k=(B.second-A.second)/(B.first-A.first);
    if(k==0) return Para(p.first,A.second);
    Para Z((p.first+A.first)/2+(p.second-A.second)/2*k,0);
    Z.second=k*Z.first+A.second-k*A.first;
    return Z;
}