//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 100001
#define mod 10007
#define eps 1e-9
//const int inf=0x7fffffff; //无限大
const int inf=0x3f3f3f3f;
/*
inline ll read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int buf[10];
inline void write(int i) {
int p = 0;if(i == 0) p++;
else while(i) {buf[p++] = i % 10;i /= 10;}
for(int j = p-1; j >=0; j--) putchar('0' + buf[j]);
printf("\n");
}
*/
//**************************************************************************************
struct node
{
int x[6],y[6],z,n;
};
node op[maxn];
vector<int> po;
char str[5];
int t,n,k;
map<int,int> H;
struct tree
{
int l,r,len;
double add1,add2,step,sum;
void init() { add1=add2=step=sum=0; }
void fun(double a,double b,double c)
{
add1+=a; add2+=b; step+=c;
sum+=(a+b)*len/2;
}
};
tree tree[maxn*4];
double calu(int st,int ed,double add1,double step)
{
int len=po[ed]-po[st];
return add1+len*step;
}
void PushUp(int ind)
{
tree[ind].sum=tree[ind<<1].sum+tree[ind<<1|1].sum;
}
void PushDown(int ind)
{
double add1=tree[ind].add1,add2=tree[ind].add2,step=tree[ind].step;
double tmp=calu(tree[ind].l,(tree[ind].l+tree[ind].r)/2,add1,step);
tree[ind<<1].fun(add1,tmp,step);
tree[ind<<1|1].fun(tmp,add2,step);
tree[ind].add1=tree[ind].add2=tree[ind].step=0;
}
void build(int lft,int rht,int ind)
{
tree[ind].l=lft; tree[ind].r=rht;
tree[ind].init(); tree[ind].len=po[rht]-po[lft];
if(lft+1!=rht)
{
int mid=tree[ind].l+tree[ind].r>>1;
build(lft,mid,ind<<1);
build(mid,rht,ind<<1|1);
}
}
void updata(int st,int ed,int ind,double add1,double add2,double step)
{
int lft=tree[ind].l,rht=tree[ind].r;
if(st<=lft&&rht<=ed) tree[ind].fun(add1,add2,step);
else
{
PushDown(ind);
int mid=tree[ind].l+tree[ind].r>>1;
if(ed<=mid) updata(st,ed,ind<<1,add1,add2,step);
else if(st>=mid) updata(st,ed,ind<<1|1,add1,add2,step);
else
{
double tmp=calu(st,mid,add1,step);
updata(st,mid,ind<<1,add1,tmp,step);
updata(mid,ed,ind<<1|1,tmp,add2,step);
}
PushUp(ind);
}
}
double query(int st,int ed,int ind)
{
int lft=tree[ind].l,rht=tree[ind].r;
if(st<=lft&&rht<=ed) return tree[ind].sum;
else
{
PushDown(ind);
int mid=tree[ind].l+tree[ind].r>>1;
double sum=0;
if(st<mid) sum+=query(st,ed,ind<<1);
if(ed>mid) sum+=query(st,ed,ind<<1|1);
PushUp(ind);
return sum;
}
}
void init()
{
memset(tree,0,sizeof(tree));
po.clear();
memset(op,0,sizeof(op));
H.clear();
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%s",str);
if(str[0]=='R')
{
op[i].z=0;
scanf("%d",&op[i].n);
for(int j=0;j<op[i].n;j++)
{
scanf("%d%d",&op[i].x[j],&op[i].y[j]);
po.push_back(op[i].x[j]);
}
}
else
{
op[i].z=1;
scanf("%d%d",&op[i].x[0],&op[i].y[0]);
po.push_back(op[i].x[0]);
po.push_back(op[i].y[0]);
}
}
sort(po.begin(),po.end());
po.erase(unique(po.begin(),po.end()),po.end());
for(int i=0;i<po.size();i++)
H[po[i]]=i;
}
void solve()
{
for(int i=0;i<n;i++)
{
int x1,y1,x2,y2;
if(op[i].z==0)
{
for(int j=0;j<op[i].n;j++)
{
x1=op[i].x[j];
y1=op[i].y[j];
x2=op[i].x[(j+1)%op[i].n];
y2=op[i].y[(j+1)%op[i].n];
if(x1>x2)
swap(x1,x2),swap(y1,y2);
else
y1=-y1,y2=-y2;
double step=(y1*1.0-y2*1.0)/(x1*1.0-x2*1.0);
updata(H[x1],H[x2],1,y1,y2,step);
}
}
else
{
x1=op[i].x[0],y1=op[i].y[0];
printf("%.3lf\n",query(H[x1],H[y1],1));
}
}
}
int main()
{
scanf("%d",&t);
while(t--)
{
init();
build(0,po.size()-1,1);
solve();
}
}