#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
void chmax(int& a, int b) {
  if (a < b) a = b;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vec<int> A(N);
  for (auto& x : A) cin >> x;
  int M = 600;
  int inf = -1e9;
  vvec<int> dp(N + 1, vec<int>(M + 1, inf));
  dp[0][0] = 1000;
  for (int i = 0; i < N; i++)
    for (int j = 0; j <= M; j++) {
      for (int k = 0; j + k <= M; k++)
        if (dp[i][j] >= k * A[i]) chmax(dp[i + 1][j + k], dp[i][j] - k * A[i]);
      for (int k = 0; j - k >= 0; k++)
        chmax(dp[i + 1][j - k], dp[i][j] + A[i] * k);
    }
  int ans = 0;
  for (int j = 0; j <= M; j++) chmax(ans, dp[N][j]);
  cout << ans << "\n";
}
