#include using namespace std; using ll = long long; void fast_io() { cin.tie(nullptr)->sync_with_stdio(false); } void solve() { ll A, B, C; cin >> A >> B >> C; ll ans = 0; ll mac = min(A, C); ans += 2 * mac + 2 * (B / 2); A -= mac, C -= mac, B -= 2 * (B / 2); ll mab = min(A, B); ans += mab + (C / 2); A -= mab, B -= mab, C -= 2 * (C / 2); cout << ans << '\n'; } int main() { fast_io(); int t = 1; cin >> t; while (t--) solve(); }