#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<pair<int, int>>>;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long dp[90][1743];
int main() {
  for (int i = 0; i < 90; i++)
    for (int j = 0; j < 1700; j++) dp[i][j] = -312312333;
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  dp[0][0] = 1000;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 1700; j++) {
      for (int k = 0; k < 1700; k++) {
        if (j >= k)
          dp[i + 1][j - k] = max(dp[i + 1][j - k], dp[i][j] + v[i] * k);
      }
      for (int k = 0; dp[i][j] >= k * v[i]; k++) {
        if (dp[i][j] >= k * v[i])
          dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] - v[i] * k);
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 1743; i++) ans = max(ans, dp[n][i]);
  cout << ans << endl;
  return 0;
}
