#include <bits/stdc++.h>
using namespace std;
long long dp[82][10010];
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i <= N; i++) cin >> A[i];
  for (long long i = 0; i < 82; i++) {
    for (long long j = 0; j < 10010; j++) {
      dp[i][j] = -1;
    }
  }
  dp[0][0] = 1000;
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 10000; j++) {
      long long m = -1;
      for (long long k = 0; k < 10000; k++) {
        if (dp[i][k] == -1) continue;
        long long next = dp[i][k] + (k - j) * A[i];
        m = m > next ? m : next;
      }
      dp[i + 1][j] = m;
      if (m == -1) break;
    }
  }
  cout << dp[N][0] << endl;
  return 0;
}
