#include <bits/stdc++.h>
const long long int mod = 1000000007;
using namespace std;
void toh_chaliye_shuru_karte_hain() {}
void code_samapti_ki_ghoshna() {}
long long int power(long long int a, long long int b, long long int modi) {
  a %= modi;
  long long int res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % modi;
    }
    b /= 2;
    a = (a * a) % modi;
  }
  return res;
}
int main() {
  toh_chaliye_shuru_karte_hain();
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int a, b, c;
    cin >> a >> b >> c;
    long long int x, y, i, j, d;
    x = b - a;
    y = c - b;
    if (y <= x) {
      if (a - y >= 0) {
        i = c;
        j = b + y;
        a = a - y;
        i += (a / 2);
      } else {
        i = b;
        j = a + x;
        c = c - x;
        i += (c / 2);
      }
    } else {
      i = b;
      j = a + x;
      c = c - x;
      i += (c / 2);
    }
    cout << i << "\n";
  }
  code_samapti_ki_ghoshna();
  return 0;
}
