#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  ;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  int mo = 1000;
  int kab = 0;
  ;
  for (int i = 0; i < (int)(n); i++) {
    bool kau = false;
    for (int j = i + 1; j < n; j++) {
      if (a[i] < a[j]) kau = true;
    }
    if (kau && mo != 0) {
      kab += mo / a[i];
      mo -= a[i] * (mo / a[i]);
    } else {
      mo += kab * a[i];
      kab = 0;
    }
    cout << i << kab << " " << mo << endl;
  }
  cout << mo << endl;
  return 0;
}
