#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const long long INF = 1e18;
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2>& p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }
long long comb(long long a, long long b) {
  long long x = max(a - b, b), ans = 1;
  for (long long K = a, L = 1; K >= x + 1; K--, L++) {
    ans *= K;
    ans /= L;
  }
  return ans;
}
int ara[MX];
pair<int, int> calc(int at, bool cond) {
  if (cond) {
    for (int K = at; K > 0; K--) {
      if (ara[K] < ara[K - 1]) {
        pair<int, int> res = calc(K - 1, 0);
        int money = res.first;
        int num = money / ara[K];
        money = num * ara[K];
        return make_pair(res.first - money, num);
      }
    }
    return make_pair(1000 - ara[0] * ((int)1000 / ara[0]), (int)1000 / ara[0]);
  } else {
    for (int K = at; K > 0; K--) {
      if (ara[K] > ara[K - 1]) {
        pair<int, int> res = calc(K - 1, 1);
        int money = res.first + ara[K] * res.second;
        return make_pair(money, 0);
      }
    }
    return make_pair(1000, 0);
  }
}
void task() {
  int n;
  cin >> n;
  for (int K = 0; K < n; K++) cin >> ara[K];
  pair<int, int> ans = calc(n - 1, 0);
  cout << ans.first << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  task();
  return 0;
}
