#include <bits/stdc++.h>
using namespace std;
template <class Type>
void line(const Type &a) {
  int cnt = 0;
  for (const auto &elem : a) {
    if (cnt++) cerr << ' ';
    cerr << elem;
  }
  cerr << endl;
}
template <class Type_a, class Type_b>
bool chmax(Type_a &a, const Type_b &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class Type_a, class Type_b>
bool chmin(Type_a &a, const Type_b &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 0; i < (n); ++i) cin >> a[i + 1];
  vector<vector<int> > dp(n + 1, vector<int>(1000, -1));
  dp[0][0] = 1000;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < (1001); ++j)
      for (int k = 0; k < (1001); ++k) {
        if (dp[i - 1][k] < 0) break;
        int tmp = a[i] * (k - j);
        if (dp[i - 1][k] + tmp < 0) break;
        chmax(dp[i][j], dp[i - 1][k] + tmp);
      }
  }
  int ans = -1;
  for (int i = 0; i < (1001); ++i) chmax(ans, dp[n][i]);
  cout << ans << endl;
}
