#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> a(n), cnt, mins;
  for (int i = 0; i < (int)n; ++i) cin >> a[i];
  ll now = 0;
  ll price = 0;
  ll flag = a[0];
  for (int i = 0; i < (int)n - 1; ++i) {
    flag = min(flag, a[i]);
    if (a[i + 1] - a[i] >= 0)
      now += (a[i + 1] - a[i]);
    else {
      if (now == 0) continue;
      cnt.push_back(now);
      mins.push_back(abs(a[i + 1] - a[i]));
      if (mins.size() == 1) price = flag;
      now = 0;
    }
  }
  if (now != 0) cnt.push_back(now);
  ll ans = 1000;
  ll stock = 0;
  if (cnt.size() == 1) {
    sort((a).begin(), (a).end());
    price = a[0];
    cout << 1000 / price * (price + cnt[0]) + 1000 % price << endl;
    return 0;
  }
  for (int i = 0; i < (int)cnt.size(); ++i) {
    ll num = cnt[i];
    stock = ans / price;
    ans = ans % price;
    ans += stock * (price + num);
    price = price + num - mins[i];
  }
  cout << ans << endl;
  return 0;
}
