#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O3")
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 0;
  cin >> t;
  for (long long int test = 0; test < t; test++) {
    long long int x[3];
    cin >> x[0] >> x[1] >> x[2];
    sort(x, x + 3);
    long long int a = x[2], b = x[1];
    long long int p = min(b - a, x[0]);
    a += p;
    x[0] -= p;
    a += (x[0] / 2);
    b += (x[0] / 2);
    cout << min(a, b) << endl;
  }
  return 0;
}
