#include using namespace std; long long a, b, c, K; void solve() { scanf("%lld%lld%lld%lld", &a, &b, &c, &K); while (K--) { long long aa = (a + b) / 2; long long bb = (a + c) / 2; long long cc = (b + c) / 2; a = aa; b = bb; c = cc; if (a == b && b == c) break; } printf("%lld\n", a + b + c); } int main() { int tcase; scanf("%d", &tcase); while (tcase--) solve(); return 0; }