#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (int i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll t; cin >> t; while(t--){ ll a, b, c, k; cin >> a >> b >> c >> k; while(k--){ if(a%2==0 && b%2==0 && c%2==0) break; ll pre_a = a, pre_b = b, pre_c = c; a = (pre_b+pre_c)/2; b = (pre_c+pre_a)/2; c = (pre_a+pre_b)/2; } cout << a+b+c << '\n'; } }