### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    maxyen=0
    for sss in range(n):
        i=sss
        yen=1000
        kab=0
        while i < n:
            now=arr[i]
            nxt=999
            minxxx=99999
            for j in range(i+1,n):
                if j==(i+1) and arr[j]>now:
                    nxt=j
                    break
                minxxx=min(minxxx,arr[j])
                if arr[j]>now:
                    nxt=j
                    break
                else:
                    #kabu = yen // now
                    #yen = yen % now
                    #yen += kabu * minxxx
                    #kabu=0
                    now=minxxx
                    minxxx=99999
            if nxt < 999 and minxxx==99999:
                kabu = yen // now
                yen = yen % now
                yen += kabu * arr[nxt]
                kabu=0
            if nxt < 999 and minxxx<99999:
                kabu = yen // minxxx
                yen = yen % minxxx
                yen += kabu * arr[nxt]
                kabu=0

            i=nxt
        maxyen=max(maxyen,yen)
    print(maxyen)
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------