#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T>
inline bool chmin(T &x, const T &y) {
  if (x > y) {
    x = y;
    return 1;
  }
  return 0;
}
template <typename T>
inline bool chmax(T &x, const T &y) {
  if (x < y) {
    x = y;
    return 1;
  }
  return 0;
}
void solve();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  vector<vector<int>> dp(n + 1, vector<int>(100000, -1));
  dp[0][0] = 1000;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (100000); ++j) {
      if (dp[i][j] == -1) continue;
      chmax(dp[i + 1][j], dp[i][j]);
      for (int k = 0; k < (j); ++k)
        chmax(dp[i + 1][k], dp[i][j] + (j - k) * a[i]);
      for (int k = 0; k < (dp[i][j] / a[i]); ++k)
        chmax(dp[i + 1][j + k + 1], dp[i][j] - (k + 1) * a[i]);
    }
  int ans = 0;
  for (int i = 0; i < (100000); ++i) chmax(ans, dp[n][i]);
  cout << ans << "\n";
  return;
}
