#include using namespace std; long long int dp[2][21][2][301]; 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 < 2; b++) { for (int c = 0; c <= 300; 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 (b == 0) { if (a + 1 <= M) { dp[1][a + 1][1][A[i]] = max(dp[1][a + 1][1][A[i]], dp[0][a][b][c]); } } if (c != 0 && b == 1) { long long int num = (dp[0][a][b][c] / c); long long int money = dp[0][a][b][c] % c + (num * A[i]); //cout << a << ' ' << b << ' ' << c << ' ' << i << ' ' << num << ' ' << money << '\n'; dp[1][a][0][0] = max(dp[1][a][0][0], money); } } } } } //cout << dp[1][1][1][100] << ' ' << dp[1][1][0][0] << '\n'; long long int res = 0; for (int i = 0; i <= M; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k <= 300; k++) { res = max(res, dp[1][i][j][k]); } } } cout << res << '\n'; return 0; }