#include <bits/stdc++.h>
using namespace std;
const int maxn = 85;
int n, m, a[maxn];
int d[180000];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  m = 1000;
  for (int i = 1; i < n; ++i) {
    memset(d, 0, sizeof(d));
    for (int j = a[i]; j <= m; ++j)
      d[j] = max(d[j], d[j - a[i]] + a[i + 1] - a[i]);
    m += d[m];
  }
  printf("%d", m);
  return 0;
}
