#include <bits/stdc++.h>
using namespace std;
const long long int INF = (1LL << 60);
const int INF_INT = 2147483647 - 1e6 - 1;
const long long int mod = 1000000007ll;
const int mod_int = 1000000007;
long long int N;
long long int A[80];
long long int ans = 0;
void solve() {
  vector<map<long long int, long long int>> dp(N + 1);
  dp[0][0] = 1000;
  for (int i = 0; i < N; i++) {
    map<long long int, long long int> cred;
    for (auto iter = dp[i].begin(); iter != dp[i].end(); iter++) {
      long long int stock = iter->first;
      long long int money = iter->second;
      for (int j = 0;; j++) {
        long long int n_stock = stock + j;
        long long int n_money = money - j * A[i];
        if (n_money < 0) break;
        cred[n_stock] = max(cred[n_stock], n_money);
      }
      for (int j = 0;; j++) {
        long long int n_stock = stock - j;
        long long int n_money = money + j * A[i];
        if (n_stock < 0) break;
        cred[n_stock] = max(cred[n_stock], n_money);
      }
    }
    long long int prev_money = -1;
    for (auto it = (--cred.end()); it != cred.begin(); it--) {
      long long int stock = (it)->first;
      long long int money = (it)->second;
      if (prev_money < money) {
        dp[i + 1][stock] = max(dp[i + 1][stock], money);
        prev_money = money;
      }
    }
    long long int stock = (cred.begin())->first;
    long long int money = (cred.begin())->second;
    if (prev_money < money) {
      dp[i + 1][stock] = max(dp[i + 1][stock], money);
      prev_money = money;
    }
  }
  for (auto iter = dp[N].begin(); iter != dp[N].end(); iter++) {
    ans = max(ans, iter->second);
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  solve();
  cout << ans << endl;
  return 0;
}
