n = int(input())
a = list(map(int,input().split()))

cash = 1000
stock = 0

for i in range(n-1):
    if(a[i] > a[i+1]):
        cash += stock * a[i]
        stock = 0
    elif(a[i] < a[i+1]):
        stock += cash // a[i]
        cash %= a[i]
    print(cash,stock)
cash += stock * a[n-1]

print(cash)

