#include <bits/stdc++.h>
double s1, s2;
int T, n, a[255];
int main() {
  n = 250;
  scanf("%d", &T);
  double m, M;
  while (T--) {
    s1 = s2 = 0;
    m = 1e9, M = 0;
    double x;
    for (int i = 0; i < n; ++i) {
      scanf("%lf", &x);
      s1 += x, s2 += x * x;
      m = std::min(m, x);
      M = std::max(M, x);
    }
    s1 /= n;
    s2 /= n;
    s2 -= s1 * s1;
    if (s2 / s1 > 3) {
      printf("%.0f\n", 0.5 + 0.5 * (M + m));
    } else {
      printf("%.0f\n", 0.5 + (0.8 * s1 + 0.2 * s2));
    }
  }
  return 0;
}
