from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return map(int, stdin.readline().split())


def get_list():
    return list(map(int, stdin.readline().split()))

n = get_int()
ls = get_list()
peak_pts = []
inc = True
if ls[1]>ls[0]:
    peak_pts.append(0)
i = 1
while i<n:
    if ls[i]>=ls[i-1]:
        if not inc:
            peak_pts.append(i - 1)
            inc = not inc
    else:
        if inc:
            peak_pts.append(i-1)
            inc = not inc
    i += 1
if ls[-1]>=ls[-2]:
    peak_pts.append(n-1)

profit = 1000
le = len(peak_pts)
ava_bought,ava_sell = 1000,0
for ind in range(0,le,2):
    i = peak_pts[ind]
    if ind+1<le:
        midprofit = 0

        # Buy
        j = i
        totalshares = 0
        while j<peak_pts[ind+1]:
            shares = (ava_bought//ls[j])
            ava_bought -= shares*ls[j]
            midprofit -= shares*ls[j]
            ava_sell += shares*ls[j]
            totalshares += shares
            if ava_bought==0: break
            if j+1<n and ls[j+1]>ls[j]: break
            j += 1

        #Sell
        j = peak_pts[ind+1]
        midprofit += ls[j]*totalshares
        if midprofit>0:
            profit += midprofit
        ava_bought = profit
        #print(ava_bought, ava_sell, midprofit,totalshares)
print(profit)
