#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};
const ll LINF = 2e18;
const int INF = 1e9;
ll N;
vector<ll> A;
ll f(ll c, ll s, ll d) {
  if (d == N) return c;
  ll mx = 0;
  ll g = floor(c / A.at(d));
  if (g != 0) mx = max(mx, f(c - A.at(d) * g, s + g, d + 1));
  mx = max(mx, f(c + A.at(d) * s, 0, d + 1));
  mx = max(mx, f(c, s, d + 1));
  return mx;
}
void solve() {
  ll ans = f(1000, 0, 0);
  cout << ans << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  scanf("%lld", &N);
  A.resize(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve();
  return 0;
}
