#include <bits/stdc++.h>
using namespace std;
void solve();
int main() { solve(); }
long long calculate(long long num1, long long num2, long long share) {
  if (num1 > num2) {
    long long tmp = num1;
    num1 = num2;
    num2 = tmp;
  }
  long long diff = num2 - num1;
  long long add = min(share, diff);
  num1 += add;
  share -= add;
  num1 += (share / 2);
  return num1;
}
void solve() {
  long long q, a, b, c;
  cin >> q;
  while (q--) {
    cin >> a >> b >> c;
    long long ans1 = calculate(a, b, c);
    long long ans2 = calculate(a, c, b);
    long long ans3 = calculate(b, c, a);
    ans1 = max(ans1, ans2);
    ans1 = max(ans1, ans3);
    cout << ans1 << endl;
  }
}
