#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0, i_len = (n); i < i_len; i++) cin >> a[i];
  vector<map<long long, long long>> dp(n + 1);
  dp[0][0] = 1000;
  for (long long i = 0, i_len = (n); i < i_len; i++) {
    for (auto &x : dp[i]) {
      for (long long j = 0, j_len = (x.first); j < j_len; j++) {
        dp[i + 1][j] = max(dp[i + 1][j], x.second + (x.first - j) * a[i]);
      }
      for (long long j = 0, j_len = (x.second / a[i] + 1); j < j_len; j++) {
        dp[i + 1][x.first + j] =
            max(dp[i + 1][x.first + j], x.second - a[i] * j);
      }
    }
  }
  long long ans = 0;
  for (auto &x : dp[n]) ans = max(ans, x.second);
  cout << ans << "\n";
  return 0;
}
