#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int kabu = 0;
  int money = 1000;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  for (int i = 0; i < n - 1; i++) {
    if (a.at(i) < a.at(i + 1) and money != 0) {
      kabu = money / a.at(i);
      money -= kabu * a.at(i);
    } else if (a.at(i) > a.at(i + 1)) {
      money += kabu * a.at(i);
      kabu = 0;
    }
    cout << money << " " << kabu << endl;
  }
  money += a.at(n - 1) * kabu;
  cout << money << endl;
}
