#include using namespace std; void solve() { long long a, b, c, k; cin >> a >> b >> c >> k; while (k--) { long long na = (a + b) / 2, nb = (b + c) / 2, nc = (c + a) / 2; a = na, b = nb, c = nc; if (a == b && b == c) { break; } } cout << a + b + c << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { solve(); } }