#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N, 0);
  vector<int> toshi;
  for (int i = 0; i < N; i++) cin >> a.at(i);
  bool up = false;
  if (a.at(0) < a.at(1)) {
    up = true;
    toshi.push_back(0);
  }
  for (int i = 1; i < N - 1; i++) {
    if (up == true) {
      if (a.at(i) > a.at(i + 1)) {
        toshi.push_back(i);
        up = false;
      }
    } else {
      if (a.at(i) < a.at(i + 1)) {
        toshi.push_back(i);
        up = true;
      }
    }
  }
  if (a.at(N - 1) >= a.at(N - 2)) toshi.push_back(N - 1);
  int sum = 1000;
  int kabu = 0;
  for (int i = 0; i < (int)toshi.size(); i++) {
    cout << toshi.at(i) << endl;
    if (i % 2 == 0) {
      kabu = sum / a.at(toshi.at(i));
      sum = sum % a.at(toshi.at(i));
    } else {
      sum = sum + kabu * a.at(toshi.at(i));
    }
  }
  cout << sum << endl;
}
