#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  unsigned long long a[n], s = 0, y = 1000, x;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if ((i == n - 1 || a[i] > a[i + 1]) && s) {
      x = s * a[i];
      s = 0;
      y += x;
    } else if (a[i] < a[i + 1] && y >= a[i]) {
      x = y / a[i];
      s = x;
      y = y - (x * a[i]);
    }
    cout << s << " " << y << "\n";
  }
  cout << y;
}
