#include using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair; using tll=tuple; const ll INF=(1ll<<60); template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> t; while(t--){ vector v(3); cin >> v[0] >> v[1] >> v[2]; ll ans=0; ll k=min(v[0],v[2]); ans+=2*k; v[0]-=k; v[2]-=k; k=v[1]/2; ans+=2*k; v[1]-=2*k; k=min(v[0],v[1]); ans+=1*k; v[0]-=k; v[1]-=k; rep(i,3) ans+=(i+i)%3*(v[i]/2); cout << ans << endl; } }