#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long mod = 998244353;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (n); i++) cin >> a[i];
  long long m = 810;
  vector<vector<long long> > dp(n + 1, vector<long long>(m, -1));
  dp[0][0] = 1000;
  for (long long i = (0); i < (n); i++) {
    for (long long j = (0); j < (m); j++) {
      if (dp[i][j] == -1) continue;
      long long t = 1;
      while (dp[i][j] >= a[i] * t) {
        dp[i + 1][j + t] = max(dp[i + 1][j + t], dp[i][j] - a[i] * t);
        t++;
      }
      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));
      }
    }
  }
  cout << dp[n][0] << '\n';
}
