#include #define VARNAME(x) #x #define show(x) cerr << #x << " = " << x << endl using namespace std; using ll = long long; using ld = long double; template ostream& operator<<(ostream& os, const vector& v) { os << "sz:" << v.size() << "\n["; for (const auto& p : v) { os << p << ","; } os << "]\n"; return os; } template ostream& operator<<(ostream& os, const pair& p) { os << "(" << p.first << "," << p.second << ")"; return os; } constexpr ll MOD = (ll)1e9 + 7LL; constexpr ld PI = static_cast(3.1415926535898); template constexpr T INF = numeric_limits::max() / 10; constexpr ld G = 0.001; constexpr int MAX = 50; constexpr ld X1[16] = {0, -0.5, 0, -0.5, 0, -0.5, 0, -0.5}; constexpr ld Y1[16] = {0, 0, -0.5, -0.5, 0, 0, -0.5, -0.5}; constexpr ld Z1[16] = {0, 0, 0, 0, -0.5, -0.5, -0.5, -0.5}; constexpr ld X2[16] = {-0.25, -0.75, -0.25, -0.75, -0.25, -0.75, -0.25, -0.75}; constexpr ld Y2[16] = {-0.25, -0.25, -0.75, -0.75, -0.25, -0.25, -0.75, -0.75}; constexpr ld Z2[16] = {-0.25, -0.25, -0.25, -0.25, -0.75, -0.75, -0.75, -0.75}; ld abs(const ld dx, const ld dy, const ld dz) { return sqrt(dx * dx + dy * dy + dz * dz); } ld func(const ld x, const ld y, const ld z) { ld sum = 0; for (int i = -MAX; i < MAX; i++) { for (int j = -MAX; j < MAX; j++) { for (int k = -MAX; k < MAX; k++) { if (x == 0 and y == 0 and z == 0 and i == 0 and j == 0 and k == 0) { continue; } const ld l = abs(x - i, y - j, z - k); sum += 4 * PI * exp(-l * l / 4 / G / G) / l / l * cos(x * i + y * j + z * k); sum += 1 / l * erfc(G * l); } } } return sum; } int main() { cin.tie(0); ios::sync_with_stdio(false); vector alpha(8); vector beta(8); for (int i = 0; i < 8; i++) { cin >> alpha[i]; } for (int i = 0; i < 8; i++) { cin >> beta[i]; } ld ans = 0; for (int i = 0; i < 8; i++) { ans += func(X1[i], Y1[i], Z1[i]) * alpha[i]; ans += func(X2[i], Y2[i], Z2[i]) * beta[i]; } cout << fixed << setprecision(15) << ans << endl; return 0; }