#include using namespace std; long long int dp[2][21][21][5001]; int N, M, K; int A[401]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> M >> K; for (int i = 0; i <= N; i++) { cin >> A[i]; } memset(dp, -1, sizeof(dp)); dp[1][0][0][0] = K; for (int i = 0; i <= N; i++) { memcpy(dp[0], dp[1], sizeof(dp[1])); memset(dp[1], -1, sizeof(dp[1])); for (int a = 0; a <= M; a++) { for (int b = 0; b <= M; b++) { for (int c = 0; c <= 5000; c++) { if (dp[0][a][b][c] == -1) { continue; } dp[1][a][b][c] = max(dp[1][a][b][c], dp[0][a][b][c]); if (a + 1 <= M) { int X = (dp[0][a][b][c] / A[i]); //cout << a << ' ' << b << ' ' << c << ' ' << X << ' ' << A[i] << ' ' << dp[0][a][b][c] << '\n'; if (X + c <= 5000) { dp[1][a + 1][b][X + c] = max(dp[1][a + 1][b][X + c], dp[0][a][b][c] - (X * A[i])); } } if (b + 1 <= a) { int X = c * A[i]; //cout << a << ' ' << b << ' ' << c << ' ' << X << ' ' << A[i] << ' ' << dp[0][a][b][c] << ' ' << X*A[i] << '\n'; dp[1][a][b + 1][0] = max(dp[1][a][b + 1][0], dp[0][a][b][c] + X); } } } } } long long int res = 0; for (int i = 0; i <= M; i++) { for (int j = 0; j <= M; j++) { for (int k = 0; k <= 5000; k++) { if (dp[1][i][j][k] == -1) { continue; } //cout << dp[1][i][j][k] << ' ' << i << ' ' << j << ' ' << k << '\n'; res = max(res, dp[1][i][j][k]); } } } cout << res << '\n'; return 0; }