#include "bits/stdc++.h" #define REP(i,n,N) for(int i=(n); i<(N); i++) #define RREP(i,n,N) for(int i=(N-1); i>=n; i--) #define CK(n,a,b) (a)<=(n)&&(n)<(b) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<>N>>V){ ll ans=0; ll C[110] = {}; REP(i,0,N){ cin>>C[i]; } int ind=N; REP(i,0,N){ ans+=C[i]; if(ind==N&&C[i]=V){ p(ans); }else{ V-=N; int d1 = V/ind; int d2 = V%ind; REP(i,0,ind){ ans+=C[i]*(d1+(d2>0)); d2--; } p(ans); } } }