#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T x) {
  std::cout << x << " ";
}
template <typename T>
void println(T x) {
  std::cout << x << "\n";
}
signed main(void) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) {
    cin >> a[i];
  }
  long long dp[11][81];
  for (long long w = 0; w < (81); w++) {
    dp[0][w] = 0;
    if (1000 - a[0] * w >= 0) {
      dp[1][w] = 1000 - a[0] * w;
    } else {
      dp[1][w] = -10e10;
    }
  }
  dp[0][0] = dp[1][0] = 1000;
  for (long long i = (2); i < (n + 1); i++) {
    for (long long j = 0; j < (11); j++) {
      dp[i][j] = dp[i - 1][j];
      for (long long k = 0; k < (11); k++) {
        dp[i][j] = max(dp[i][j], (dp[i - 1][k] - (j - k) * a[i - 1]));
      }
    }
  }
  cout << dp[n][0] << endl;
}
