#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
const int mod = 1000000007, MAX = 2005, INF = 1 << 30;
int dp[MAX][MAX];
int main() {
  std::ifstream in("text.txt");
  std::cin.rdbuf(in.rdbuf());
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < MAX; i++)
    for (int j = 0; j < MAX; j++) dp[i][j] = -INF;
  dp[0][0] = 1000;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= 500; j++) {
      if (dp[i][j] < 0) continue;
      for (int k = 0; k <= j; k++) {
        chmax(dp[i + 1][j - k], dp[i][j] + A[i] * k);
      }
      for (int k = 0; k <= dp[i][j] / A[i]; k++) {
        chmax(dp[i + 1][j + k], dp[i][j] - A[i] * k);
      }
    }
  }
  cout << dp[N][0] << endl;
}
