#include #define REP(i,n) for(int i=0,i##_len=int(n);i>t; REP(_,t) { ll a,b,c,k; cin>>a>>b>>c>>k; while(k--) { if(a==b && b==c) break; ll tmp[3] = {(b+c) / 2, (a+c) / 2, (a+b) / 2}; a = tmp[0]; b = tmp[1]; c = tmp[2]; } // cerr << a << " " << b << " " << c << "\n"; cout << a + b + c << "\n"; } }