#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INFint = 1e9 + 1;
const ll INFll = (ll)1e18 + 1;
ll MOD = 1e9 + 7;
int dp[100][30] = {0};
int main() {
  for (int i(0); i < 100; i++) {
    for (int j(0); j < 30; j++) {
      dp[i][j] = -1;
    }
  }
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i(0); i < N; i++) cin >> A[i];
  dp[0][0] = 1000;
  for (int i(0); i < N; i++) {
    for (int j(0); j <= 20; j++) {
      if (dp[i][j] == -1) continue;
      for (int k(0); k <= 20; k++) {
        if (j + k <= 20 && dp[i][j] - A[i] * k >= 0) {
          dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] - A[i] * k);
        }
      }
      for (int k(1); k <= j; k++) {
        dp[i + 1][j - k] = max(dp[i + 1][j - k], dp[i][j] + A[i] * k);
      }
    }
  }
  cout << dp[N][0] << endl;
  return 0;
}
