#include <bits/stdc++.h>
using namespace std;
int main() {
  long long tests, a, b, c;
  cin >> tests;
  while (tests--) {
    cin >> a >> b >> c;
    vector<long long> v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    sort(v.begin(), v.end());
    a = v[0];
    b = v[1];
    c = v[2];
    if (a + c <= b)
      cout << a + c << '\n';
    else if (a + c > b) {
      cout << (a + b + c) / 2 << '\n';
    }
  }
}
