#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(100);
int test_cases;
cin >> test_cases;
auto solve_costs = [&](vector<ll>& a, vector<ld>& cost) -> ld {
int n = (int) a.size();
vector<ld> pre(n);
for (int i = 0; i < n; i++) {
if (i == 0) {
pre[i] = cost[i];
} else {
pre[i] = pre[i - 1] + cost[i];
}
}
auto sum = [&](int l, int r) -> ld {
return pre[r] - (l == 0 ? 0 : pre[l - 1]);
};
vector<ld> mult(n);
for (int i = 0; i < (n + 1) / 2; i++) {
if (i == 0) {
mult[i] = sum(0, n - 1);
} else {
mult[i] = mult[i - 1] + sum(i, n - 1 - i);
}
}
for(int i = (n + 1) / 2; i < n; i++) {
mult[i] = mult[n - 1 - i];
}
for (int i = 0; i < n; i++) {
mult[i] -= cost[0];
}
ld ret = 0;
for (int i = 0; i < n; i++) {
ret += a[i] * mult[i];
}
return ret;
};
auto solve_case = [&](int tc) {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<ll> pre(n);
for (int i = 0; i < n; i++) {
if (i == 0) {
pre[i] = a[i];
} else {
pre[i] = pre[i - 1] + a[i];
}
}
auto small_choose = [&](ll x, ll y) -> ld {
if (y == 0) {
return 1;
} else if (y == 1) {
return x;
} else {
return x * (x - 1) / 2;
}
};
auto sum = [&](int l, int r) -> ll {
return pre[r] - (l == 0 ? 0 : pre[l - 1]);
};
auto evaluate = [&](int l, int r) -> ld {
int bad = (l != 0) + (r != n - 1);
int good = r - l;
return sum(l, r) / small_choose(bad + good, bad);
};
ld ans = 0;
for (int r = 1; r < n; r++) {
ans += evaluate(0, r);
}
for (int l = 1; l < n - 1; l++) {
ans += evaluate(l, n - 1);
}
vector<ll> shrink(n - 2);
vector<ld> cost1(n - 2);
vector<ld> cost2(n - 2);
for (int i = 1; i < n - 1; i++) {
shrink[i - 1] = a[i];
}
for (int i = 1; i < n - 1; i++) {
cost1[i - 1] = ((ld) 1) / i;
cost2[i - 1] = ((ld) 1) / (i + 1);
}
ans += 2 * solve_costs(shrink, cost1);
ans -= 2 * solve_costs(shrink, cost2);
cout << ans << '\n';
};
for (int tc = 1; tc <= test_cases; tc++) {
cout << "Case #" << tc << ": ";
solve_case(tc);
}
}