Problem: Good job! Now that Heidi is able to distinguish between Poisson and uniform distributions, she is in a good position to actually estimate the populations.

Can you help Heidi estimate each village's population?

Input

Same as the easy version.

Output

Output one line per village, in the same order as provided in the input, containing your (integer) population estimate.

Your answer is considered correct if it is an integer that falls into the interval <image>, where P is the real population of the village, used to create the distribution (either Poisson or uniform) from which the marmots drew their answers.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void doit() {
  int k = 250, sum = 0, sum2 = 0, ma = 0, a, P;
  double t;
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a);
    sum += a;
    sum2 += a * a;
    ma = max(ma, a);
  }
  P = int(1.0 * sum / k + 0.5);
  t = 1.0 * sum2 / (P * P * k);
  if (t < 1.18)
    printf("%d\n", P);
  else
    printf("%d\n", ma / 2);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) doit();
  return 0;
}