#include <bits/stdc++.h>
using namespace std;
const int N = 85;
map<int, int> dp[N];
void solve() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1000;
  for (int i = 1; i <= n; i++) {
    for (auto u : dp[i - 1]) {
      int money = u.second, stock = u.first;
      for (int buy = 0; money - buy * a[i] >= 0; buy++) {
        dp[i][stock + buy] = max(dp[i][stock + buy], money - buy * a[i]);
      }
      for (int sell = 0; sell <= stock; sell++) {
        dp[i][stock - sell] = max(dp[i][stock - sell], money + sell * a[i]);
      }
    }
  }
  int ans = 1000;
  for (auto u : dp[n]) {
    ans = max(ans, u.second);
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
