#include <bits/stdc++.h>
const int isDebugMode = 1;
using namespace std;
struct edge {
  long long to, cost;
};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
long long mpow(long long a, long long n, long long mod = MOD) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void pt() {
  cout << endl;
  return;
}
template <class Head>
void pt(Head&& head) {
  cout << head;
  pt();
  return;
}
template <class Head, class... Tail>
void pt(Head&& head, Tail&&... tail) {
  cout << head << " ";
  pt(forward<Tail>(tail)...);
}
void dpt() {
  if (!isDebugMode) return;
  cout << endl;
  return;
}
template <class Head>
void dpt(Head&& head) {
  if (!isDebugMode) return;
  cout << head;
  pt();
  return;
}
template <class Head, class... Tail>
void dpt(Head&& head, Tail&&... tail) {
  if (!isDebugMode) return;
  cout << head << " ";
  pt(forward<Tail>(tail)...);
}
template <class T>
void debug(T v) {
  if (!isDebugMode) return;
  for (int i = 0; i < (v.size()); ++i) cout << v[i] << " ";
  cout << endl;
}
template <class T>
void debug2(T v) {
  if (!isDebugMode) return;
  for (int i = 0; i < (v.size()); ++i) {
    for (int j = 0; j < (v[i].size()); ++j) cout << v[i][j] << " ";
    cout << endl;
  }
}
template <class T1, class T2>
inline bool chmin(T1& a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T1, class T2>
inline bool chmax(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T1, class T2>
long long recgcd(T1 a, T2 b) {
  return a % b ? recgcd(b, a % b) : b;
}
bool valid(long long H, long long W, long long h, long long w) {
  return 0 <= h && h < H && 0 <= w && w < W;
}
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < (N); ++i) cin >> a[i];
  vector<vector<long long>> dp(N + 1, vector<long long>(100, -1));
  dp[0][0] = 1000;
  for (int i = 0; i < (N); ++i)
    for (int j = 0; j < (100); ++j) {
      for (int k = 0; k < (100); ++k) {
        if (dp[i][k] >= 0 && dp[i][k] + (k - j) * a[i] >= 0)
          chmax(dp[i + 1][j], dp[i][k] + (k - j) * a[i]);
      }
    }
  long long res = 0;
  for (int i = 0; i < (100); ++i) chmax(res, dp[N][i]);
  pt(res);
  return 0;
}
