#include <bits/stdc++.h>
using namespace std;
int maxProfit(vector<int>& prices, int tot) {
  int share = 0;
  int i = 0;
  while (i < prices.size() - 1) {
    while (i < prices.size() - 1 && prices[i] >= prices[i + 1]) i++;
    while (tot >= prices[i]) {
      share++;
      tot -= prices[i];
    }
    while (i < prices.size() - 1 && prices[i] <= prices[i + 1]) i++;
    while (share > 0) {
      tot += prices[i];
      share--;
    }
  }
  return tot;
}
int main() {
  int n;
  cin >> n;
  vector<int> p(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int ans = maxProfit(p, 1000);
  cout << ans << endl;
  return 0;
}
