# 全部使え オールオアナッシングや

n = int(input())
a = list(map(int, input().split()))

dp = {}


def rec(i, money, stock):
    if (i, money, stock) in dp:
        return dp[(i, money, stock)]
    if i == n:
        return money
    # 有り金全部株に変える
    ret2 = 0
    if money > 0:
        p = money // a[i]
        ret2 = rec(i + 1, money - p * a[i], stock + p)
    # 有り株全部金に変える
    ret3 = 0
    if stock > 0:
        ret3 = rec(i + 1, money + stock * a[i], 0)
    ret = max(money, ret2, ret3)
    dp[(i, money, stock)] = ret
    return ret


print(rec(0, 1000, 0))
