#include <bits/stdc++.h>
using namespace std;
inline char get(void) {
  static char buf[100000], *p1 = buf, *p2 = buf;
  if (p1 == p2) {
    p2 = (p1 = buf) + fread(buf, 1, 100000, stdin);
    if (p1 == p2) return EOF;
  }
  return *p1++;
}
inline void read(int &x) {
  x = 0;
  static char c;
  for (; !(c >= '0' && c <= '9'); c = get())
    ;
  for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = get())
    ;
}
int T, a[260];
double avg, cnt;
inline void solve(void) {
  avg = cnt = 0;
  for (int i = 1; i <= 250; i++) read(a[i]), avg += a[i];
  avg /= 250.0;
  for (int i = 1; i <= 250; i++) {
    double x = a[i] / avg;
    if (x >= 0.5 && x <= 1.5) cnt++;
  }
  cnt /= 250.0;
  if (cnt > 0.7) {
    printf("%d\n", (int)(avg + 0.5));
  } else {
    int t = *max_element(a, a + 250);
    printf("%d\n", t / 2);
  }
}
int main(void) {
  for (read(T); T--;) solve();
  return 0;
}
