def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = []

    for i in range(n-1):
        if a[i] < a[i+1]:
            break
    if i < n:
        b.append(a[i])

    pm = 1
    tmp = a[i]
    j = n-1
    for j in range(i+1,n-1):
        if a[j] > pm * a[j+1]:
            b.append(a[j])
            pm *= -1
            tmp = a[j]

    if tmp < a[n-1]:
        b.append(a[n-1])
    ans = 1000
    hand = 0
    for i in range(len(b) // 2):
        x,y = b[2*i], b[2*i+1]
        t = ans // x
        ans -= t * x
        hand += t
        ans += hand * y
        hand = 0

    print(ans)


if __name__ == "__main__":
    resolve()
