#include <bits/stdc++.h>
using namespace std;
const int N = 10000000;
long long a[81], n;
long long f[N];
long long m = 1000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    memset(f, 0, sizeof f);
    if (a[i] < a[i + 1])
      for (int j = a[i]; j <= m; j++)
        f[j] = max(f[j], f[j - a[i]] + a[i + 1] - a[i]);
    m += f[m];
  }
  cout << m << endl;
  return 0;
}
