#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { ll t, a, b, c; cin >> t; for (int i = 0; i < t; i++){ ll max1 = 0; cin >> a >> b >> c; if (a && c){ ll tmp = min(a, c); max1 += tmp*2; if (a >= c){ a -= c; c = 0; } else { c -= a; a = 0; } } if (b%2) max1 += (b-1); else max1 += b; if (c && c%2) max1 += (c - 1); else if (c) max1 += c; cout << max1 << "\n"; } }