#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int A[maxn];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    memset(A, 0, sizeof(A));
    int n;
    scanf("%d", &n);
    long long int sum = 0;
    int a = -0x3f3f3f3f;
    for (int i = 0; i < n; i++) {
      scanf("%d", &A[i]);
      sum += A[i];
      a = max(a, A[i]);
    }
    printf("%.6lf\n", (double)(sum - a) / (n - 1) + a);
  }
  return 0;
}
