#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, const char *argv[]) {
  vector<int> abc(3);
  int k;
  cin >> abc[0] >> abc[1] >> abc[2];
  cin >> k;

  vector<int>::iterator iter = max_element(abc.begin(), abc.end());
  size_t index = distance(abc.begin(), iter);

  abc[index] *= (int)pow(2.0, (double)k);
  cout << accumulate(abc.begin(), abc.end(), 0) << endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std ; 
const int inf = 1012345678;

int main(){
  int64_t N  ;
  cin >> N ; 
  
  int64_t a , b , c , d , e ; 
  cin >> a >> b >> c >> d >> e ; 
  int64_t min_t = min( a , min( min(b,c),min(d,e) ) ) ; 
  //cout << min_t << endl ;
  
  if(N%min_t ==  0 ){
    cout << N/min_t + 4 << endl ; 
  }
  else{
  	cout << (N/min_t) + 4 + 1 << endl ;
  }

  //975529666566238
}