#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}
template <template <typename, typename...> class ContainerType,
          typename ValueType, typename... Args>
void print(const ContainerType<ValueType, Args...> &c) {
  for (const auto &v : c) cout << v << ' ';
  cout << '\n';
}
void print() { cout << '\n'; }
template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " ";
  print(args...);
}
long long llipower(long long x, long long y, long long p = LLONG_MAX) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  a.push_back(0);
  long long s = 0;
  long long m = 1000;
  for (long long i = 0; i < n; i++) {
    if (a[i + 1] > a[i]) {
      while (m >= a[i]) {
        s++;
        m -= a[i];
      }
    } else if (a[i + 1] < a[i]) {
      while (s > 0) {
        s--;
        m += a[i];
      }
    }
  }
  cout << max(m, 0LL) << "\n";
}
