N = 2
ARR = [157, 193]

N = 6
ARR = [200, 180, 160, 140, 120, 100]

N = 7
ARR = [100, 130, 130, 130, 115, 115, 150]

N = int(input())
ARR = list(map(int, input().split()))


# N = 5
# ARR = [157, 193, 193, 193, 191]

def prepare(n,arr):
    result = []
    for i in range(n):
        if i == 0:
            result.append(arr[0])
        else:
            if arr[i] != arr[i-1]:
                result.append(arr[i])
    return result
def calculate(arr):
    n = len(arr)
    result = []
    for i in range(n):
        if i == 0:
            if i + 1 < n:
                if arr[i + 1] > arr[i]:
                    result.append({'type': 0, 'value': arr[i]})
            continue

        if i == n - 1:
            if i - 1 >= 0:
                if arr[i] > arr[i - 1]:
                    result.append({'type': 1, 'value': arr[i]})
            continue

        if (i - 1 >= 0) and (i + 1 < n):
            if arr[i] > arr[i + 1]:
                result.append({'type': 1, 'value': arr[i]})

            if arr[i] < arr[i + 1]:
                result.append({'type': 0, 'value': arr[i]})

    money = 1000
    num = 0

    for res in result:
        type = res.get('type')
        value = res.get('value')
        if type == 0:
            num += money // value
            money -= num * value
        else:
            money += num * value
            num = 0

    print(money)

arr = prepare(N, ARR)
calculate(arr)
