#include using namespace std; typedef long long LL; int T; LL A, B, C, K; void solve() { scanf("%lld%lld%lld%lld", &A, &B, &C, &K); while (K--) { LL tA = B + C >> 1, tB = A + C >> 1, tC = A + B >> 1; A = tA, B = tB, C = tC; if (A == B && B == C) break; } printf("%lld\n", A + B + C); } int main() { #ifndef ONLINE_JUDGE freopen("data/data1.in", "r", stdin); // freopen("data/data1.out", "w", stdout); #endif scanf("%d", &T); while (T--) solve(); return 0; }