#include int main () { int t = 0; long long a = 0LL; long long b = 0LL; long long c = 0LL; long long k = 0LL; int res = 0; res = scanf("%d", &t); while (t > 0) { res = scanf("%lld", &a); res = scanf("%lld", &b); res = scanf("%lld", &c); res = scanf("%lld", &k); while (k > 0LL && (a%2LL != b%2LL || b%2LL != c%2LL)) { long long na = (b+c)/2LL; long long nb = (c+a)/2LL; long long nc = (a+b)/2LL; a = na; b = nb; c = nc; k -= 1LL; } printf("%lld\n", a+b+c); t--; } return 0; }