#include using namespace std; using ll = long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> t; rep(houren,t){ ll a,b,c,k,ans = 0, x = 0; cin >> a >> b >> c >> k; ans += a/2*2; ans += b/2*2; ans += c/2*2; x += (a&1); x += (b&1); x += (c&1); cout << ans + max(0LL, x-k) << '\n'; } return 0; }