#include //make_tuple emplace_back next_permutation push_back make_pair second first setprecision #if MYDEBUG #include "lib/cp_debug.hpp" #else #define DBG(...) ; #endif using LL = long long; constexpr LL LINF=334ll<<53; constexpr int INF=15<<26; constexpr LL MOD=1E9+7; namespace Problem{ using namespace std; class Writer{ static ostringstream oss; public:template void appendln(const vector> &ans,string spl=" ", string el="\n"){for(int i=0; i<(int)ans.size(); ++i){for(int j=0; j<(int)ans[i].size(); ++j){oss << ans[i][j];oss << (j==(int)ans[i].size()-1?el:spl);}}} template void appendln(const vector& ans, string spl=" "){for(int i=0; i<(int)ans.size(); ++i){oss << ans[i] << (i==(int)ans.size()-1?"\n":spl);}} template void appendln(const T& answer){oss << answer << "\n";} template void append(const T& answer){oss << answer;} void appends(const string spl){oss.seekp((int)oss.tellp()-1);oss<<"\n";} templatevoid appends(const string spl,const F& fi, const R&... rest){oss << fi << spl; appends(spl, rest...);} static void write(){cout << oss.str();} Writer(){static bool is_single =true;assert(is_single);is_single=false;}; };ostringstream Writer::oss; class Solver{ public: double q[4][4][4]={}; double ans = 0.0; void solve(){ cin >> q[0][0][0]; cin >> q[0][0][2]; cin >> q[0][2][0]; cin >> q[0][2][2]; cin >> q[2][0][0]; cin >> q[2][0][2]; cin >> q[2][2][0]; cin >> q[2][2][2]; cin >> q[1][1][1]; cin >> q[1][1][3]; cin >> q[1][3][1]; cin >> q[1][3][3]; cin >> q[3][1][1]; cin >> q[3][1][3]; cin >> q[3][3][1]; cin >> q[3][3][3]; double e1 = 0.0; int ub = 50; int lb = -ub; double rmax = ub; double pi = acos(-1.0); double sigma = 0.478942; DBG(1.0/sqrt(2.0*pi)+0.08) for(int i=lb; i<=ub; ++i){ for(int j=lb; j<=ub; ++j){ for(int k=lb; k<=ub; ++k){ if(abs(i)+abs(j)+abs(k)>rmax-1e-10)continue; for(int d=0; d<=3; ++d){ for(int e=0; e<=3; ++e){ for(int f=0; f<=3; ++f){ if(i==0 and j==0 and k==0 and d==0 and e==0 and f==0)continue; e1 += q[d%4][e%4][f%4]*erfc(dist(i,j,k,d,e,f)/sqrt(2.0)/sigma)/dist(i,j,k,d,e,f); } } } DBG(i,j,k,e1) } } } ub = 50; lb = -ub; rmax = ub; double e2 = 0.0; for(int i=lb; i<=ub; ++i){ cerr<rmax-1e-10)continue; double tmp = exp(-2.0*pi*pi*g(i,j,k)*sigma*sigma)/pi/g(i,j,k); double tmp2 = 0.0; for(int d=0; d<=3; ++d){ for(int e=0; e<=3; ++e){ for(int f=0; f<=3; ++f){ tmp2+=q[d%4][e%4][f%4]*cos(2.0*pi*(i*d+j*e+k*f)/4.0); } } } e2+=tmp*tmp2/pi; } } } double e3 = q[0][0][0]*sqrt(2.0/pi)/sigma; cerr<