#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np # %% N, M, K = map(int, readline().split()) A = np.array([0] + read().split(), np.int64) # %% dp = np.zeros((N + 2, M + 1), np.int64) dp[0, 0] = K dp[1, 0] = K for sell in range(2, N + 2): dp[sell] = dp[sell - 1] for buy in range(1, sell): x = dp[buy - 1, :-1] + dp[buy - 1, :-1] // A[buy] * (A[sell] - A[buy]) np.maximum(dp[sell, 1:], x, out=dp[sell, 1:]) # %% print(dp.max())