from sys import stdin
input = stdin.readline

N = int(input())
A = list(map(int, input().split()))

start = 0
money = 1000

for i in range(N - 1):
    if A[i + 1] > A[i]:
        tmp = 10 ** 3
        for k in range(i, start - 1, -1):
            tmp = min(A[k], tmp)
        print(A[i + 1], tmp)
        buy = money // tmp
        money -= tmp * buy
        money += buy * A[i + 1]
        start = i + 1

print(money)
