#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A;
int INIT = 1000;
int MONEY;
int KABU;
int main() {
  std::cout << std::fixed << std::setprecision(20);
  cin >> N;
  A = vector<int>(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  MONEY = INIT;
  KABU = 0;
  for (int i = 0; i < N; i++) {
    if (i == N - 1) {
      while (KABU > 0) {
        KABU--;
        MONEY += A[i];
      }
      cout << MONEY << endl;
      return 0;
    }
    if (A[i] < A[i + 1]) {
      while (MONEY >= A[i]) {
        KABU++;
        MONEY -= A[i];
      }
      continue;
    }
    if (i > 0 && A[i - 1] <= A[i] && A[i] > A[i + 1]) {
      while (KABU > 0) {
        KABU--;
        MONEY += A[i];
      }
      continue;
    }
  }
}
