#include using namespace std; void solve(){ long long a, b, c, k; cin >> a >> b >> c >> k; long long ta, tb, tc; k=min(k,80ll); while(k > 0){ ta = (b+c)/2; tb = (a+c)/2; tc = (b+a)/2; a = ta, b = tb, c = tc; if(a == b && b == c){ break; } k--; } cout << (a+b+c) << "\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while(t--){ solve(); } return 0; }