#include #include typedef long long int int64; #define MAX(a,b) ((a)>(b)?(a):(b)) #define POS(i,j) ((i)*(m+1)+(j)) void run(void){ int n,m,k; scanf("%d%d%d",&n,&m,&k); int *a=(int *)calloc(n+1,sizeof(int)); int i; for(i=0;i<=n;i++) scanf("%d",a+i); int64 *dp=(int64 *)calloc((n+1)*(m+1),sizeof(int64)); dp[POS(0,m)]=k; for(i=1;i<=n;i++){ dp[POS(i,m)]=k; for(int j=m-1;j>=0;j--){ int64 local=dp[POS(i-1,j)]; for(int k=i-1;k>=0;k--){ int64 v=dp[POS(k,j+1)]; local=MAX(local,v%a[k]+(v/a[k])*a[i]); } dp[POS(i,j)]=local; } } int64 ans=0; for(i=0;i<=m;i++) ans=MAX(ans,dp[POS(n,i)]); printf("%d\n",ans); } int main(void){ run(); return 0; }