#include <bits/stdc++.h>
using namespace std;
const int N = 100;
const int M = 1000;
int dp[N][M];
void solve() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 1000;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < M; j++) {
      if (dp[i - 1][j] != -1) {
        int money = dp[i - 1][j];
        for (int buy = 0; money - buy * a[i] >= 0; buy++) {
          if (j + buy < M)
            dp[i][j + buy] = max(dp[i][j + buy], money - buy * a[i]);
        }
        for (int sell = 0; sell <= j; sell++) {
          dp[i][j - sell] = max(dp[i][j - sell], money + sell * a[i]);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < M; i++) {
    ans = max(ans, dp[n][i]);
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
