#include <bits/stdc++.h>
using namespace std;
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  }
  long long mon = 1000, st = 0;
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long start = 0;
  while (start < n - 1 && a[start] >= a[start + 1]) start++;
  if (start == n - 1) {
    cout << 1000 << "\n";
    return 0;
  }
  while (mon - a[start] >= 0) mon -= a[start], st++;
  long long pos = start + 1;
  while (1) {
    while (pos < n - 1 && a[pos] <= a[pos + 1]) pos++;
    while (st) mon += a[pos], st--;
    while (pos < n - 1 && a[pos] >= a[pos + 1]) pos++;
    if (pos != n - 1) {
      while (mon - a[pos] >= 0) mon -= a[pos], st++;
    } else
      break;
  }
  cout << mon << "\n";
}
