def main():

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

    K = 10**6
    INF = 10**18
    dp = [[-INF]*K for i in range(n+1)]
    dp[0][0] = 1000
    for i in range(n):
        for j in range(K):
            dp[i+1][j] = dp[i][j]
        # sell
        for j in range(K):
            if j == 0:
                continue
            if dp[i][j] >= 0:
                #if i == 2 and j == 10:
                    #print(dp[i+1][0], dp[i][j]+j*A[i])
                dp[i+1][0] = max(dp[i+1][0], dp[i][j]+j*A[i])
                #if i == 2 and j == 10:
                    #print(dp[i+1][0])

        # buy
        for j in range(K):
            if dp[i][j] >= 0:
                q, r = divmod(dp[i][j], A[i])
                dp[i+1][q] = max(r, dp[i+1][q])
    #print(dp[1])
    ans = -INF
    for j in range(K):
        ans = max(ans, dp[n][j])
    print(ans)

if __name__ == '__main__':
    main()
