#include <bits/stdc++.h>
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
const int inf = INT_MAX / 2;
const long long infl = 1LL << 60;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int N, A[101];
long long dp[81][1010];
void _main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N + 1; i++)
    for (int have = 0; have < 500; have++) dp[i][have] = -infl;
  dp[0][0] = 1000;
  for (int i = 0; i < N; i++)
    for (int hav = 0; hav < 500; hav++) {
      for (int buy = 0; buy < 500; buy++) {
        if (dp[i][hav] < buy * A[i]) break;
        chmax(dp[i + 1][hav + buy], dp[i][hav] - buy * A[i]);
      }
      for (int sold = 0; sold < hav + 1; sold++) {
        chmax(dp[i + 1][hav - sold], dp[i][hav] + sold * A[i]);
      }
    }
  long long ans = -infl;
  for (int hav = 0; hav < 500; hav++) chmax(ans, dp[N][hav]);
  cout << ans << endl;
}
