#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c;
    cin >> a >> b >> c;
    long long q, p;
    q = min(a, b);
    p = max(a, b);
    c = c - (p - q);
    if (c % 2 == 0) {
      c /= 2;
      p += c;
    } else {
      c -= 1;
      c /= 2;
      p += c;
    }
    cout << p << endl;
  }
  return 0;
}
