#include <bits/stdc++.h>
int N, A[81] = {};
int BecomeHigher(int i) {
  int j;
  for (j = i; j <= N; j++) {
    if (A[j] > A[i]) {
    }
  }
}
int main(void) {
  int i, j, cash = 1000, stock = 0;
  int top, bottom, price;
  scanf("%d", &N);
  for (i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
  }
  i = 1;
  while (i <= N) {
    if (i != top && i != bottom) {
      top = i;
      for (j = i + 1; j <= N; j++) {
        if (A[j] > A[i] && (A[j] > A[j + 1] || j == N)) {
          top = j;
          break;
        }
      }
      if (top == i) break;
      bottom = i;
      for (j = i + 1; j < top; j++) {
        if (A[j] < A[i] && A[j] < A[j + 1]) {
          bottom = j;
          break;
        }
      }
      i = bottom;
    } else if (i == bottom) {
      while (1) {
        if (cash >= A[i]) {
          cash -= A[i];
          stock++;
        } else {
          break;
        }
      }
      i = top;
    } else if (i == top) {
      while (1) {
        if (stock > 0) {
          cash += A[i];
          stock--;
        } else {
          break;
        }
      }
      i = i + 1;
    }
  }
  printf("%d\n", cash);
  return 0;
}
