n = int(input())
aa = tuple(map(int, input().split()))

def dfs(money, stock, i):
    global aa
    global n

    if i == n:
        return money

    ns = money // aa[i]
    return max(
        dfs(money, stock, i + 1),
        dfs(money + stock * aa[i], 0, i + 1),
        dfs(money - aa[i] * ns, stock + ns, i + 1)
    )

ans = dfs(1000, 0, 0)
print(ans)