#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
using pii = pair<int, int>;
ll dp[81][2000];
int a[81];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < 2000; j++) {
      dp[i][j] = -(1LL << 50);
    }
  }
  dp[0][0] = 1000;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2000; j++) {
      for (int k = 0; k <= j; k++) {
        dp[i + 1][j - k] = max(dp[i + 1][j - k], dp[i][j] + a[i + 1] * k);
      }
      for (int k = 0; k + j < 2000 && dp[i][j] >= a[i + 1] * k; k++) {
        dp[i + 1][k + j] = max(dp[i + 1][k + j], dp[i][j] - a[i + 1] * k);
      }
    }
  }
  cout << dp[n][0];
  return 0;
}
