题意:
解法:
设四个数为a,b,c,d。
显然用a*2更新b,用b*2更新c,用c*2更新d.
因为n是在整数,因此接下来只可能会用1L的和2L的,即c和d,
优先用d,多出来的部分用c即可.
code:
#include <bits/stdc++.h>
#define int long long
#define PI pair<int,int>
using namespace std;
const int maxm=2e6+5;
void solve(){
int a,b,c,d;cin>>a>>b>>c>>d;
b=min(b,2*a);
c=min(c,2*b);
d=min(d,2*c);
int n;cin>>n;
int ans=n/2*d;
n%=2;
ans+=n*c;
cout<<ans<<endl;
}
signed main(){
ios::sync_with_stdio(0);
solve();
return 0;
}