#include using namespace std; #define pb push_back using ll = long long; using vi = vector ; const ll mod = 1e9 + 7; int main() { ios::sync_with_stdio(0); int T; cin >> T; while(T --) { ll a, b, c, k; cin >> a >> b >> c >> k; for(ll i = 0; i < k; i ++) { if(a == b && a == c) break; ll A = (b + c) / 2; ll B = (c + a) / 2; ll C = (a + b) / 2; a = A; b = B; c = C; } cout << a + b + c << '\n'; } }