#include <iostream>                                                                                                                                                                                                                                                                
#include <algorithm>                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                   
using namespace std;                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                   
int main()                                                                                                                                                                                                                                                                         
{                                                                                                                                                                                                                                                                                  
    long long Q, H, S, D, N;                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                   
    cin >> Q >> H >> S >> D >> N;                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                   
    H = min(Q*2, H);                                                                                                                                                                                                                                                               
    S = min(H*2, S);                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                   
    cout << N/2 * min(S*2, D) + N%2 * S << endl;                                                                                                                                                                                                                                   
}                                                                                                                                                                                                                                                                                  
   

Measured memory_bytes: 256