#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;
int cnt[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    memset(cnt, 0, sizeof(cnt));
    int n = 250;
    bool pois = 0;
    long long int sum = 0;
    int maxi = 0;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      maxi = max(maxi, x);
      sum += x;
      if (x > 2000) {
        pois = 1;
      } else {
        cnt[x]++;
      }
    }
    sum = round((double)sum / (double)n);
    maxi *= 1.005;
    long long int s1 = 0;
    long long int s2 = 0;
    int dev = sqrt(sum);
    for (int i = max(sum - dev, 0LL); i <= sum + dev; i++) {
      s1 += cnt[i];
    }
    s2 = long long int(2 * dev + 1) * long long int(n) /
             (long double)(2 * sum + 1) +
         20;
    if (s1 > s2) {
      pois = 1;
    } else {
      pois = 0;
    }
    if (pois)
      cout << sum << endl;
    else
      cout << maxi / 2 << endl;
  }
}
