#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    double avarg = 0.0, ans = 0, sum = 0;
    int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
    }
    if (n == 1)
      cout << fixed << setprecision(9) << sum << '\n';
    else {
      sort(arr, arr + n);
      sum = sum - arr[n - 1];
      ans = arr[n - 1] + (sum / double(n - 1));
      cout << fixed << setprecision(9) << ans << '\n';
    }
  }
}
