#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int sta[n + 1];
  sta[0] = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < a[i + 1]) {
      sta[i + 1] = 1;
    } else if (a[i] > a[i + 1]) {
      sta[i + 1] = 0;
    } else {
      sta[i + 1] = sta[i];
    }
  }
  sta[n] = 0;
  long long have = 0;
  long long mon = 1000;
  long long save = 1000;
  for (int i = 0; i < n; i++) {
    if (sta[i + 1] == 0) {
      while (have > 0) {
        mon = mon + a[i];
        have = have - 1;
      }
      save = mon;
    } else {
      while (mon >= 0) {
        have = have + 1;
        mon = mon - a[i];
      }
      have = have - 1;
      mon = mon + a[i];
    }
  }
  printf("%lld\n", save);
  return 0;
}
