#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
const double pi=3.141592653;
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n); double ans=; double x1,y1,x2,y2; for(int i=;i<=n;i++){
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
double temp=fabs(atan2(y1,x1)-atan2(y2,x2));//atan2,特别注意
if(temp>pi)
temp=2.0*pi-temp;
ans+=temp; }
printf("%.5lf\n",ans/(pi*2.0)); }
return ;
}
05-23 03:18