import threading
import sys
import functools


def main():
    N = int(input())
    A = [int(x) for x in input().split(" ")]

    @functools.lru_cache(maxsize=None)
    def solve(stock: int, money: int, day: int, end_day: int) -> int:
        if end_day == day:
            return money

        current_price = A[day]

        money_buy = money - (money // current_price) * current_price
        stock_buy = (money // current_price) + stock

        money_sell = money + stock * current_price
        stock_sell = 0

        return max(
            solve(stock, money, day + 1, end_day),
            solve(stock_buy, money_buy, day + 1, end_day),
            solve(stock_sell, money_sell, day + 1, end_day),
        )

    print(solve(0, 1000, 0, N))


if __name__ == "__main__":

    sys.setrecursionlimit(1024 * 1024 * 2)
    threading.stack_size(128 * 1024 * 1024 * 2)
    threading.Thread(target=main).start()
