/****************************
* Advitiya Brijesh *
* Speedcuber :P *
****************************/
// WA TLE MLE RE IDLE and counting...
#include<bits/stdc++.h>
using namespace std;
// std macros
typedef long long ll;
typedef vector<list<ll> > vli;
typedef vector<ll > vi;
typedef vector<pair<ll,ll> > vpll;
typedef vector<pair<int,int> > vpii;
typedef pair<int ,int> pii;
// dereference
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define in insert
#define pu push
#define fr front
// loops
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,a,b) for(int i=a;i<=b;++i)
#define PER(i,b,a) for(int i=b;i>=a;--i)
#define all(X) (X).begin(), (X).end()
// I/O
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sll2(x,y) scanf("%lld%lld",&x,&y)
#define sll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define sd(n) scanf("%d",&n)
#define sll(n) scanf("%lld",&n)
#define sc(n) scanf("%c",&n)
#define ss(n) scanf("%s",n)
#define oll(n) printf("%lld\n",n)
// debug
#define debug(x) cout<<"debug->"<<#x<<"::"<<x<<endl
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
// set values
#define mset(n,k) memset(n,k,sizeof(n))
#define MOD 1000000007
ll INV2=500000004;
ll INV6=166666668;
//modular expo
ll power(ll a,ll b, ll c){
ll x=1,y=a;
while(b>0){
if(b&1)
x=(x*y)%c;
y=(y*y)%c;
b/=2;
}
return x%c;
}
//perfect numbers till 10^6 6, 28, 496, 8128
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};//clockwise from left
long double doit(long double x,long double a0,long double a1,long double a2,long double a3,long double a4,long double a5,long double a6)
{
long double val=a0*a0*pow(x,13)/13.0 + pow(x,12)*(2*a0*a1)/12.0 + pow(x,11)*(2*a0*a2+a1*a1)/11.0 + pow(x,10)*(2*a0*a3+2*a1*a2)/10.0 + pow(x,9)*(2*a0*a4+2*a1*a3+a2*a2)/9.0 + pow(x,8)*(2*a0*a5+2*a1*a4+2*a2*a3)/8.0 + pow(x,7)*(2*a0*a6+2*a1*a5+2*a2*a4+a3*a3)/7.0 + pow(x,6)*(2*a1*a6+2*a2*a5+2*a3*a4)/6.0 + pow(x,5)*(2*a2*a6+2*a3*a5+a4*a4)/5.0 + pow(x,4)*(2*a3*a6+2*a4*a5)/4.0 + pow(x,3)*(2*a4*a6+a5*a5)/3.0 + pow(x,2)*(2*a5*a6)/2.0 + pow(x,1)*(a6*a6)/1.0;
long double pi=acos(-1);
return pi*val;
}
long double func(long double a,long double b,long double a0,long double a1,long double a2,long double a3,long double a4,long double a5,long double a6)
{
return doit(b,a0,a1,a2,a3,a4,a5,a6)-doit(a,a0,a1,a2,a3,a4,a5,a6);
}
long double f(long double x,long double a0,long double a1,long double a2,long double a3,long double a4,long double a5,long double a6)
{
return pow(x,6)*a0 + pow(x,5)*a1 + pow(x,4)*a2 + pow(x,3)*a3 + pow(x,2)*a4 + pow(x,1)*a5 + a6;
}
long double fder(long double x,long double a1,long double a2,long double a3,long double a4,long double a5,long double a6)
{
return 5*a1*pow(x,4)+4*a2*pow(x,3)+3*a3*pow(x,2)+2*a4*x+a5;
}
long double f2(long double x,long double a0,long double a1,long double a2,long double a3,long double a4,long double a5,long double a6)
{
return f(x,a0,a1,a2,a3,a4,a5,a6)*f(x,a0,a1,a2,a3,a4,a5,a6);
}
long double area(long double x,long double sl,long double a0,long double a1,long double a2,long double a3,long double a4,long double a5,long double a6)
{
long double theta=360/sl;
long double val=f2(x,a0,a1,a2,a3,a4,a5,a6);
theta=sin(theta)/2;
return val*theta;
}
int main()
{
int t;
sd(t);
REP(p,1,t)
{
long double n;
scanf("%Lf",&n);
long double a[10];
rep(i,n+1)
scanf("%Lf",&a[i]);
long double a0,a1,a2,a3,a4,a5,a6;
a0=a1=a2=a3=a4=a5=a6=0;
if(n==1)
a5=a[0],a6=a[1];
if(n==2)
a4=a[0],a5=a[1],a6=a[2];
if(n==3)
a3=a[0],a4=a[1],a5=a[2],a6=a[3];
if(n==4)
a2=a[0],a3=a[1],a4=a[2],a5=a[3],a6=a[4];
if(n==5)
a1=a[0],a2=a[1],a3=a[2],a4=a[3],a5=a[4],a6=a[5];
long double aa,bb,slices,stacks;
scanf("%Lf%Lf%Lf%Lf",&aa,&bb,&slices,&stacks);
long double tr=func(aa,bb,a0,a1,a2,a3,a4,a5,a6);
long double ap=0,vv=(bb-aa)/stacks;
for(int i=0;i<stacks;++i)
{
long double as=aa+(i)*vv;
long double bs=aa+(i+1)*vv;
long double theta=360.0/slices;
long double pi=acos(-1);
theta=theta*pi/180;
long double fas=f(as,a0,a1,a2,a3,a4,a5,a6),fbs=f(bs,a0,a1,a2,a3,a4,a5,a6);
long double zero=as-((bs-as)/(fbs-fas))*fas;
long double ar1=((bs-zero)*f2(bs,a0,a1,a2,a3,a4,a5,a6)*slices*sin(theta))/6.0;
long double ar2=((as-zero)*f2(as,a0,a1,a2,a3,a4,a5,a6)*slices*sin(theta))/6.0;
long double ar=ar1-ar2;
ap+=ar;
}
long double ans=fabs(tr-ap);
ans/=tr;
ans*=100.0;
printf("Case %d: %.4Lf\n",p,ans);
}
return 0;
}
LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioKKiAgCSAgQWR2aXRpeWEgQnJpamVzaAkJKgoqICAJCVNwZWVkY3ViZXIgOlAgICAgICAgKgoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwovLyBXQSBUTEUgTUxFIFJFIElETEUgYW5kIGNvdW50aW5nLi4uCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Ci8vICAgICAgc3RkIG1hY3Jvcwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiB2ZWN0b3I8bGlzdDxsbD4gPiB2bGk7CnR5cGVkZ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JsZSBuOwogICAgICAgIHNjYW5mKCIlTGYiLCZuKTsKICAgICAgICBsb25nIGRvdWJsZSBhWzEwXTsKICAgICAgICByZXAoaSxuKzEpCiAgICAgICAgCXNjYW5mKCIlTGYiLCZhW2ldKTsKICAgICAgICBsb25nIGRvdWJsZSBhMCxhMSxhMixhMyxhNCxhNSxhNjsKICAgICAgICBhMD1hMT1hMj1hMz1hND1hNT1hNj0wOwogICAgICAgIGlmKG49PTEpCiAgICAgICAgICAgIGE1PWFbMF0sYTY9YVsxXTsKICAgICAgICBpZihuPT0yKQogICAgICAgICAgICBhND1hWzBdLGE1PWFbMV0sYTY9YVsyXTsKICAgICAgICBpZihuPT0zKQogICAgICAgICAgICBhMz1hWzBdLGE0PWFbMV0sYTU9YVsyXSxhNj1hWzNdOwogICAgICAgIGlmKG49PTQpCiAgICAgICAgICAgIGEyPWFbMF0sYTM9YVsxXSxhND1hWzJdLGE1PWFbM10sYTY9YVs0XTsKICAgICAgICBpZihuPT01KQogICAgICAgICAgICBhMT1hWzBdLGEyPWFbMV0sYTM9YVsyXSxhND1hWzNdLGE1PWFbNF0sYTY9YVs1XTsKICAgICAgICBsb25nIGRvdWJsZSBhYSxiYixzbGljZXMsc3RhY2tzOwogICAgICAgIAogICAgICAgIHNjYW5mKCIlTGYlTGYlTGYlTGYiLCZhYSwmYmIsJnNsaWNlcywmc3RhY2tzKTsKICAgICAgICAKICAgICAgICBsb25nIGRvdWJsZSB0cj1mdW5jKGFhLGJiLGEwLGExLGEyLGEzLGE0LGE1LGE2KTsKICAgICAgICAKICAgICAgICBsb25nIGRvdWJsZSBhcD0wLHZ2PShiYi1hYSkvc3RhY2tzOwogICAgICAgIAogICAgICAgIGZvcihpbnQgaT0wO2k8c3RhY2tzOysraSkKICAgICAgICB7CiAgICAgICAgICAgIGxvbmcgZG91YmxlIGFzPWFhKyhpKSp2djsKICAgICAgICAgICAgbG9uZyBkb3VibGUgYnM9YWErKGkrMSkqdnY7CiAgICAgICAgICAgIGxvbmcgZG91YmxlIHRoZXRhPTM2MC4wL3NsaWNlczsKICAgICAgICAgICAgbG9uZyBkb3VibGUgcGk9YWNvcygtMSk7CiAgICAgICAgICAgIHRoZXRhPXRoZXRhKnBpLzE4MDsKICAgICAgICAgICAgbG9uZyBkb3VibGUgZmFzPWYoYXMsYTAsYTEsYTIsYTMsYTQsYTUsYTYpLGZicz1mKGJzLGEwLGExLGEyLGEzLGE0LGE1LGE2KTsKICAgICAgICAgICAgbG9uZyBkb3VibGUgemVybz1hcy0oKGJzLWFzKS8oZmJzLWZhcykpKmZhczsKICAgICAgICAgICAgbG9uZyBkb3VibGUgYXIxPSgoYnMtemVybykqZjIoYnMsYTAsYTEsYTIsYTMsYTQsYTUsYTYpKnNsaWNlcypzaW4odGhldGEpKS82LjA7CiAgICAgICAgICAgIGxvbmcgZG91YmxlIGFyMj0oKGFzLXplcm8pKmYyKGFzLGEwLGExLGEyLGEzLGE0LGE1LGE2KSpzbGljZXMqc2luKHRoZXRhKSkvNi4wOwogICAgICAgICAgICBsb25nIGRvdWJsZSBhcj1hcjEtYXIyOwogICAgICAgICAgICBhcCs9YXI7CiAgICAgICAgfQogICAgICAgIGxvbmcgZG91YmxlIGFucz1mYWJzKHRyLWFwKTsKICAgICAgICBhbnMvPXRyOwogICAgICAgIGFucyo9MTAwLjA7CiAgICAgICAgCiAgICAgICAgcHJpbnRmKCJDYXNlICVkOiAlLjRMZlxuIixwLGFucyk7CiAgICB9CiAgICAKICAgIAogICAgcmV0dXJuIDA7Cn0=