#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int N;
int smax = 10000;
int main() {
  cin >> N;
  vector<int> a(N);
  vector<vector<ll>> dp(82, vector<ll>(smax, -1));
  dp[0][0] = 1000;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < smax; j++) {
      if (dp[i][j] < 0) continue;
      ll tmp = dp[i][j] / a[i];
      for (int k = 0; k <= tmp; k++) {
        chmax(dp[i + 1][j + k], dp[i][j] - k * a[i]);
      }
      for (int k = j; k >= 0; k--) {
        chmax(dp[i + 1][j - k], dp[i][j] + k * a[i]);
      }
    }
  }
  ll ans = -1;
  for (int i = 0; i < smax; i++) {
    if (dp[N][i] < 0) continue;
    chmax(ans, dp[N][i] + i * a[N - 1]);
  }
  cout << ans << endl;
}
