#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define BET(a,b,c) ((a)<=(b)&&(b)<(c)) #define FOR(i,n) for(int i=0,i##_end=(int(n));i VI; typedef vector VVI; int main() { int N, V; cin>>N>>V; VI C(N); vector S(N); FOR(i,N) cin>>C[i]; S[0] = C[0]; for(int i=1;i 0){ int maxUnitIndex = 0; FOR(i,N) if(S[i] * (maxUnitIndex + 1) > S[maxUnitIndex] * (i+1)){ maxUnitIndex = i; } int upper = N * N * N; if(upper < V){ long long need = (V - upper) / maxUnitIndex; ans += need * S[maxUnitIndex]; V -= need * (maxUnitIndex+1); } vector dp(V + 1, 1LL<<60); dp[0] = 0; FOR(i,N) { FOR(j,V+1){ dp[j] = min(dp[j], dp[j-(i+1)] + S[i]); } } ans += dp[V]; } cout<