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

nn=1000//100*5
dp=[[0]*nn for i in range(n)]

ni=1000//a[0]
for i in range(ni):    
    dp[0][i]=1000-a[0]*i

for k in range(1,n):
    for i in range(nn):
        xmax=0
        for ii in range(nn):
            x=dp[k-1][ii]+(ii-i)*a[k]
            if x<0:continue
            if dp[k-1][i]//a[k-1]<ii:break
            xmax=max(xmax,x) 
        dp[k][i]=xmax

print(dp[n-1][0])
