#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<string>
#include<queue>
using namespace std;
struct node
{
int x,y,z,t,h;///x代表客户来的时间,y代表客户办理业务需要的时间,z代表轮到该客户办业务时的时间,t代表该客户自来到银行到办完业务离开的时间,h代表该客户办完业务离开的时间。
};
int main()
{
int T;
cin >> T;
while(T--)
{
int n;
queue<node>q1;
queue<node>q2;
cin >> n;
int mm = 0;
int a,b;
int x1 = 0;
int x2 = 0;
double sum = 0;
for(int i=0; i<n; i++)
{
cin >> a >> b;
if(a>=0 && a<=360)
{
mm++;
if(!q1.empty())
{
struct node aa = q1.front();
while(aa.h <= a)
{
sum = sum + aa.t;
q1.pop();
if(q1.empty())
{
break;
}
aa = q1.front();
}
}
if(!q2.empty())
{
struct node bb = q2.front();
while(bb.h <= a)
{
sum = sum + bb.t;
q2.pop();
if(q2.empty())
{
break;
}
bb = q2.front();
}
}
if(q1.size() > q2.size())
{
struct node dd;
dd.x = a;
dd.y = b;
if(a >= x2)
{
dd.z = a;
}
else
{
dd.z = x2;
}
dd.t = (dd.z - a)+ b;
dd.h = dd.z + b;
q2.push(dd);
x2 = dd.h;
}
else
{
struct node cc;
cc.x = a;
cc.y = b;
if(a >= x1)
{
cc.z = a;
}
else
{
cc.z = x1;
}
cc.t = (cc.z - a)+ b;
cc.h = cc.z + b;
q1.push(cc);
x1 = cc.h;
}
}
}
while(!q1.empty())
{
struct node ee;
ee = q1.front();
sum = sum + ee.t;
q1.pop();
}
while(!q2.empty())
{
struct node ff;
ff = q2.front();
sum = sum + ff.t;
q2.pop();
}
double hh;
hh = (sum) / (mm*1.0);
printf("%.2lf\n",hh);
}
return 0;
}