#include <iostream>                                                                                                                                                                                                
                                                                                                                                                                                                                   
using namespace std;                                                                                                                                                                                               
                                                                                                                                                                                                                   
int main(){                                                                                                                                                                                                        
                                                                                                                                                                                                                   
  int A,B,C,K;                                                                                                                                                                                                     
  int ans = 0;                                                                                                                                                                                                     
                                                                                                                                                                                                                   
  cin >> A >> B >> C >> K;                                                                                                                                                                                         
                                                                                                                                                                                                                   
  int max = A;                                                                                                                                                                                                     
                                                                                                                                                                                                                   
  if(max < B){                                                                                                                                                                                                     
    ans += max;                                                                                                                                                                                                    
    max = B;                                                                                                                                                                                                       
  }                                                                                                                                                                                                                
  else{                                                                                                                                                                                                            
    ans += B;                                                                                                                                                                                                      
  }                                                                                                                                                                                                                
  if(max < C){                                                                                                                                                                                                     
    ans += max;                                                                                                                                                                                                    
    max = C;                                                                                                                                                                                                       
  }                                                                                                                                                                                                                
  else{                                                                                                                                                                                                            
    ans += C;                                                                                                                                                                                                      
  }                                                                                                                                                                                                                
                                                                                                                                                                                                                   
  while(K > 0){                                                                                                                                                                                                    
    max *= 2;                                                                                                                                                                                                      
    K--;                                                                                                                                                                                                           
  }                                                                                                                                                                                                                
                                                                                                                                                                                                                   
  cout << ans + max << "\n";                                                                                                                                                                                       
                                                                                                                                                                                                                   
  return 0;                                                                                                                                                                                                        
}                                                                                                                                                                                                                  
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
                

Measured memory_bytes: 256