#include <bits/stdc++.h>
using namespace std;
const long long N = 3e6 + 10;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const long long mod = 1e9 + 7;
long long T, casnum;
long long a[N];
signed main() {
  scanf("%lld", &T);
  while (T--) {
    long long sum = 0;
    long long maxx = -inf;
    long long n;
    scanf("%lld", &n);
    for (long long i = 1; i <= n; i++) {
      scanf("%lld", &a[i]);
      maxx = max(maxx, a[i]);
      sum += a[i];
    }
    if (n == 1) {
      cout << a[1] << "\n";
      continue;
    }
    double minn = 1.0 * (sum - maxx) / (n - 1);
    printf("%.8lf\n", 1.0 * (minn + maxx));
  }
  return 0;
}
