#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  vector<int> a;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int aa;
    cin >> aa;
    a.push_back(aa);
  }
  long long int money = 1000;
  int stock = 0;
  int price = a[0];
  int i = 0;
  int temp = 0;
  stock += money / a[i];
  money = money % a[i];
  i++;
  cout << stock << " " << money << " 1 " << endl;
  while (i < N - 1) {
    if (price > a[i]) {
      if (a[i] >= a[i + 1]) {
      } else if (a[i] < a[i + 1]) {
        price = a[i];
        stock += money / a[i];
        money = money % a[i];
      }
    }
    if (price < a[i]) {
      if (a[i] > a[i + 1]) {
        money = stock * a[i] + money;
        stock = 0;
        price = a[i];
      }
    }
    cout << i << " " << stock << " " << money << " " << price << endl;
    i++;
  }
  money += stock * (a[N - 1]);
  if (money >= 1000)
    cout << money << endl;
  else {
    cout << "1000" << endl;
  }
}
