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

l=[]
for i in range(n-1):
    if a[i+1]>a[i]:
        l.append(1)
    elif a[i+1]==a[i]:
        l.append(0)
    else:
        l.append(-1)

m=1000
k=0
for i in range(n-1):
    if l[i]==1:
        p=m//a[i]
        k+=p
        m-=p*a[i]

    if l[i]==-1:
        m+=k*a[i]
        k=0
    print(k,m)
m+=k*a[n-1]
print(m)
