#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 19;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1E-11;
const int MX = 100005;
void make(int P, int A[]) {
  for (int i = 0; i < 250; i++) {
    A[i] = rand() % (2 * P + 1);
  }
}
void Do() {
  int A[255] = {};
  for (int i = 0; i < 250; i++) scanf("%d", A + i);
  double avg = 0;
  for (int i = 0; i < 250; i++) avg += A[i];
  avg /= 250.0;
  int cnt = 0;
  for (int i = 0; i < 250; i++) {
    double X = (double)A[i] / avg;
    if (0.5 <= X && X <= 1.5) ++cnt;
  }
  double C = cnt / 250.0;
  if (C > 0.7) {
    printf("%d\n", (int)(avg + 0.5));
  } else {
    int t = *max_element(A, A + 250);
    printf("%d\n", t / 2);
  }
}
int main() {
  int V;
  scanf("%d", &V);
  while (V--) {
    Do();
  }
  return 0;
}
