#include
using namespace std;
int main()
{
int t,time;
while(~scanf("%d",&t))
{
for(time=0; time {
int i,n,goal;
scanf("%d",&n);
float a[13],b[13],c[13],p[13];
for(i=0; i {
scanf("%f",&a[i]);
}
for(i=0; i {
scanf("%f",&b[i]);
}
for(i=0; i {
scanf("%f",&c[i]);
p[i]=1-(1-a[i])*(1-b[i])*(1-c[i]);
}
scanf("%d",&goal );
float pos=0;
for(int exm=0; exm<(1< {
float cor=1*1.0;
int r,num=0;
for(r=0; r<=n; r++)
{
if(exm&(1< {
if(num<=goal)
{
cor*=p[r];
num+=1;
}
else
break;
}
else
{
cor*=(1-p[r]);
}
}
if(num==goal)
pos+=cor;
}
printf("%.4f\n",pos);
}
}
return 0;
}