#include #include #include #include using namespace std; typedef long long lint; typedef vectorvi; typedef pairpii; #define rep(i,n)for(int i=0;i<(int)(n);++i) double q[4][4][4]; const int R=70; double calc(int low,int high,double decfac,bool trunc){ double volt=0.0; for(int i=low;i<=high;++i){ for(int j=low;j<=high;++j){ for(int k=low;k<=high;++k){ rep(l,4){ double x=4*i+l; if(trunc&&x>4*R)continue; rep(m,4){ double y=4*j+m; if(trunc&&y>4*R)continue; rep(nn,2){ int n=2*nn+((l+m)%2); double z=4*k+n; if(trunc&&z>4*R)continue; double fac=1; #define dec(x) if(x==4*low||x==4*high)fac*=decfac; dec(x); dec(y); dec(z); double sq=sqrt(x*x+y*y+z*z)/4; if(sq==0)continue; volt+=q[l][m][n]/sq*fac; } } } } } } return volt; } int main(){ rep(i, 8) { int u = 2 * (i / 4); int v = 2 * (i / 2 % 2); int w = 2 * (i % 2); cin>>q[u][v][w]; } rep(i, 8) { int u = 2 * (i / 4) + 1; int v = 2 * (i / 2 % 2) + 1; int w = 2 * (i % 2) + 1; cin>>q[u][v][w]; } double volt=calc(-R,R,0.5,true); double volt_notrunc=calc(-R,R,1,false); printf("%.15f\n",(volt+volt_notrunc)/2); }