#include <bits/stdc++.h>
using namespace std;
const long long INF = LLONG_MAX;
const long long SZ = 8e4 + 5;
const long long mod = 1e9 + 7;
long long n;
long long a[82];
int main() {
  long long cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0,
            t = 0;
  string s, s1, s2;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  long long now = 0;
  long long m = 1000;
  for (i = 1; i <= n; i++) {
    j = i + 1;
    while (j <= n && a[j] <= a[j - 1]) {
      j++;
    }
    k = j - 1;
    if (k == n) break;
    while (m >= a[k]) {
      c++;
      m -= a[k];
    }
    j = k + 1;
    while (j <= n && a[j] >= a[j - 1]) {
      j++;
    }
    k = j - 1;
    while (c > 0) {
      m += a[k];
      c--;
    }
    i = k;
  }
  cout << m << "\n";
  return 0;
}
