#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long double PI = acos(-1.0);
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> b;
  for (int i = 0; i < n - 1; i++) {
    int tmp = a[i + 1] - a[i];
    if (tmp == 0) continue;
    if (b.size() == 0) {
      b.push_back(tmp);
      continue;
    }
    if (b.size() >= 1) {
      int& x = b.back();
      if (x * tmp > 0) {
        b.back() += tmp;
        continue;
      }
      b.push_back(tmp);
    }
  }
  int pos = 1000;
  int stock = 0;
  int price = a[0];
  if (b.size() == 0) {
    cout << pos << endl;
    return 0;
  }
  for (auto x : b) {
    if (x > 0) {
      stock += pos / price;
      pos %= price;
    } else if (x < 0) {
      pos += stock * price;
      stock = 0;
    }
    price += x;
  }
  if (stock != 0) {
    pos += stock * price;
    stock = 0;
  }
  cout << pos << endl;
  return 0;
}
