package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	A := make([]int, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}

	var money int = 1000
	var kabu int = 0

	for i := 0; i < N-1; i++ {
		if A[i] < A[i+1] {
			kabu = kabu + money/A[i]
			money = money % A[i]
		} else {
			money = money + kabu*A[i]
			kabu = 0
		}
		fmt.Println(kabu, money)
	}

	money = money + kabu*A[N-1]
	kabu = 0

	fmt.Println(money)

}
