import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)
from functools import lru_cache

    
class Solution:
    def __init__(self,prices):
        self._max = 0
        self.prices = prices
    
    @lru_cache(None)
    def transaction(self, money, stock, i):
        if i == len(self.prices):
            self._max = max(self._max, money)
            return
        
        _stock = stock
        _money = money
        ## buy
        if money >= self.prices[i]:
            stock, money = divmod(money, self.prices[i])
            # print("buy",money,stock,i)
            self.transaction(money, stock, i + 1)
        # backtracking
        money,stock = _money,_stock

        ## sell
        if stock > 0:
            stock, money = 0, stock * self.prices[i] + money
            if money > 1000:
                self.transaction(money, 0, i + 1)
        # backtracking
        money,stock = _money,_stock

        ## do nothing
        self.transaction(money, stock, i + 1)


def main():
    n = int(input().strip())
    A = [int(i) for i in input().strip().split()]
    solver = Solution(A)
    solver.transaction(1000, 0, 0)
    print(solver._max)
    

if __name__ == "__main__":
    main()