#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
int n, k;
long long a[maxn], dp[200][340];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    cin >> a[i];
  }
  for (int i = (0); i <= (80); ++i) {
    for (int j = (0); j <= (330); ++j) dp[i][j] = -1;
  }
  for (int i = (1); i <= (35); ++i) dp[0][0] = 1000;
  for (int i = (0); i <= (330); ++i) {
    if (1000 / a[1] >= i) dp[1][i] = 1000 - a[1] * i;
  }
  for (int i = (2); i <= (n); ++i) {
    for (int j = (0); j <= (330); ++j) {
      for (int k = (0); k <= (330); ++k) {
        if (dp[i - 1][k] >= 0 && (dp[i - 1][k] + a[i] * k) / a[i] >= j) {
          dp[i][j] = max(dp[i][j], dp[i - 1][k] + (a[i]) * k - (j)*a[i]);
        }
      }
    }
  }
  cout << dp[n][0];
  return 0;
}
