#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (long long i = 0; i < n; i++) cin >> arr[i];
  vector<vector<long long> > dp(n + 1,
                                vector<long long>((long long)600000, -1));
  long long moneytmp = 1000;
  dp[0][0] = 1000;
  for (long long k = 1; moneytmp >= 0; k++) {
    moneytmp -= arr[0];
    if (moneytmp < 0) break;
    dp[0][k] = moneytmp;
  }
  for (long long i = 0; i < n; i++) {
    bool ok = true;
    long long best;
    for (long long j = 0; j < (long long)600000 && dp[i][j] != -1; j++) {
      best = max(best, dp[i][j] + arr[i] * j);
    }
    for (long long j = 0; j < (long long)600000 && dp[i][j] != -1; j++) {
      long long cur = best - j * arr[i];
      if (cur < 0) break;
      dp[i + 1][j] = max(dp[i][j], cur);
    }
  }
  long long ans = dp[n][0];
  cout << ans << endl;
}
