import std.conv, std.functional, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.container, std.math, std.numeric, std.range, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; } int readInt() { return readToken.to!int; } long readLong() { return readToken.to!long; } real readReal() { return readToken.to!real; } bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } } bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } } int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; } int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); } int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); } enum LIM = 1000; real dist(real x, real y, real z) { return sqrt(x^^2 + y^^2 + z^^2); } void main() { /* 4(A0 + A3) = -B A0 + A1 + A2 + A3 + B = 0 */ /* foreach (i; 0 .. 3) { real A0, A1, A2, A3, B; switch (i) { case 0: A0 = 0; A1 = -1; A2 = 1; A3 = 0; B = 0; break; case 1: A0 = -1; A1 = 0; A2 = 0; A3 = 1; B = 0; break; case 2: A0 = -0.25; A1 = -0.75; A2 = 0; A3 = 0; B = 1; break; default: assert(false); } real sum = 0.0; if (A0 != 0.0) { debug { int cnt; } real tmp = 0.0; foreach (z; 1 .. LIM) { debug { cnt += 6; } tmp += 6.0 / dist(0.0, 0.0, z); } foreach (y; 1 .. LIM) foreach (z; 1 .. LIM) { debug { cnt += 12; } tmp += 12.0 / dist(0.0, y, z); } foreach (x; 1 .. LIM) foreach (y; 1 .. LIM) foreach (z; 1 .. LIM) { debug { cnt += 8; } tmp += 8.0 / dist(x, y, z); } debug { cnt += 3; } tmp += 3.0 / dist(LIM, 0.0, 0.0); foreach (z; 1 .. LIM) { debug { cnt += 12; } tmp += 12.0 / dist(LIM, 0.0, z); } foreach (y; 1 .. LIM) foreach (z; 1 .. LIM) { debug { cnt += 12; } tmp += 12.0 / dist(LIM, y, z); } debug { cnt += 3; } tmp += 3.0 / dist(LIM, LIM, 0.0); foreach (z; 1 .. LIM) { debug { cnt += 6; } tmp += 6.0 / dist(LIM, LIM, z); } debug { cnt += 1; } tmp += 1.0 / dist(LIM, LIM, LIM); debug { writeln("A0: ", cnt); } sum += A0 * tmp; } if (A1 != 0.0) { debug { int cnt; } real tmp = 0.0; foreach (z; 0 .. LIM) { debug { cnt += 2; } tmp += 2.0 / dist(0.0, 0.0, 0.5 + z); } foreach (y; 1 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 8; } tmp += 8.0 / dist(0.0, y, 0.5 + z); } foreach (x; 1 .. LIM) foreach (y; 1 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 8; } tmp += 8.0 / dist(x, y, 0.5 + z); } foreach (z; 0 .. LIM) { debug { cnt += 4; } tmp += 4.0 / dist(LIM, 0.0, 0.5 + z); } foreach (y; 1 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 8; } tmp += 8.0 / dist(LIM, y, 0.5 + z); } foreach (z; 0 .. LIM) { debug { cnt += 2; } tmp += 2.0 / dist(LIM, LIM, 0.5 + z); } debug { writeln("A1: ", cnt); } sum += A1 * tmp; } if (A2 != 0.0) { debug { int cnt; } real tmp = 0.0; foreach (y; 0 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 4; } tmp += 4.0 / dist(0.0, 0.5 + y, 0.5 + z); } foreach (x; 1 .. LIM) foreach (y; 0 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 8; } tmp += 8.0 / dist(x, 0.5 + y, 0.5 + z); } foreach (y; 0 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 4; } tmp += 4.0 / dist(LIM, y + 0.5, z + 0.5); } debug { writeln("A2: ", cnt); } sum += A2 * tmp; } if (A3 != 0.0) { debug { int cnt; } real tmp = 0.0; foreach (x; 0 .. LIM) foreach (y; 0 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 8; } tmp += 8.0 / dist(0.5 + x, 0.5 + y, 0.5 + z); } debug { writeln("A3: ", cnt); } sum += A3 * tmp; } if (B != 0) { debug { int cnt; } real tmp = 0.0; foreach (x; 0 .. LIM) foreach (y; 0 .. LIM) foreach (z; 0 .. LIM) { debug { cnt += 8; } tmp += 1.0 / dist(0.25 + x, 0.25 + y, 0.25 + z); tmp += 1.0 / dist(0.25 + x, 0.25 + y, 0.75 + z); tmp += 1.0 / dist(0.25 + x, 0.75 + y, 0.25 + z); tmp += 1.0 / dist(0.25 + x, 0.75 + y, 0.75 + z); tmp += 1.0 / dist(0.75 + x, 0.25 + y, 0.25 + z); tmp += 1.0 / dist(0.75 + x, 0.25 + y, 0.75 + z); tmp += 1.0 / dist(0.75 + x, 0.75 + y, 0.25 + z); tmp += 1.0 / dist(0.75 + x, 0.75 + y, 0.75 + z); } debug { writeln("B: ", cnt); } sum += B * tmp; } writefln("%.10f,", sum); } //*/ enum real[] COEF = [ 0.0370094894, 3.6061578391, 1.3661877722, ]; try { for (; ; ) { auto INPUT = new real[16]; foreach (j; 0 .. 16) { INPUT[j] = readReal(); } real ans = 0.0; ans += COEF[0] * (INPUT[3] + INPUT[5] + INPUT[6]); ans += COEF[1] * INPUT[7]; ans += COEF[2] * INPUT[8 .. 16].sum; writefln("%.10f", ans); } } catch (EOFException e) { } }