#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<P, P>;
int main() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < (n); ++i) {
    cin >> arr[i];
  }
  ll res = 1000;
  queue<PP> que;
  que.push(PP(P(1000, 0), P(0, 0)));
  while (!que.empty()) {
    PP t = que.front();
    que.pop();
    ll m = t.first.first;
    ll s = t.first.second;
    ll d = t.second.first;
    ll b = t.second.second;
    if (m > res) {
      res = m;
    }
    if (d + 1 > n) {
      continue;
    }
    que.push(PP(P(m, s), P(d + 1, b)));
    {
      ll mt = m;
      ll st = s;
      if (mt >= arr[d]) {
        ll k = mt / arr[d];
        mt -= arr[d] * k;
        st += k;
        que.push(PP(P(mt, st), P(d + 1, arr[d])));
      }
    }
    {
      ll mt = m;
      ll st = s;
      if (st > 0 && arr[d] > b) {
        mt += arr[d] * st;
        st = 0;
        que.push(PP(P(mt, st), P(d + 1, 0)));
      }
    }
  }
  cout << res << endl;
  return 0;
}
