#include int main () { int t = 0; int res = 0; res = scanf("%d", &t); while (t > 0) { long long a = 0LL; long long b = 0LL; long long c = 0LL; long long ans = 0LL; res = scanf("%lld", &a); res = scanf("%lld", &b); res = scanf("%lld", &c); ans = (b/2LL)*2LL; b %= 2LL; if (a < c) { ans += 2LL*a; c -= a; a = 0LL; ans += c/2LL; } else { ans += 2LL*c; a -= c; c = 0LL; if (a > 0LL && b > 0LL) { ans += 1LL; } } printf("%lld\n", ans); t--; } return 0; }