#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
using pint = pair<long long, long long>;
long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long dp[n + 1][3010];
  for (long long i = 0; i < n + 1; i++)
    for (long long j = 0; j < 3005; j++) dp[i][j] = 0;
  dp[0][0] = 1000;
  bool chk[n + 1][3010];
  for (long long i = 0; i < n + 1; i++)
    for (long long j = 0; j < 3005; j++) chk[i][j] = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 1000; j++) {
      for (long long k = 1; k * a[i] <= dp[i][j]; k++) {
        dp[i + 1][j + k] = max(dp[i][j] - a[i] * k, dp[i + 1][j + k]);
        chk[i + 1][j + k] = 1;
      }
      if (chk[i][j] && j != 0) {
        for (long long k = 0; k < j + 1; k++)
          dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i] * (j - k));
      }
    }
  }
  long long ans = 1000;
  for (long long i = 0; i < 3000; i++) ans = max(ans, dp[n][i]);
  cout << ans << "\n";
}
