fun main() = Thread(null, ::msolutions2020d, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun msolutions2020d() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map { it.toInt() }

    val stairs = mutableListOf(mutableListOf(aList.first()))

    for (a in aList.drop(1)) {
        if (a > stairs.last().last()) stairs.last().add(a)
        else if (a < stairs.last().last()) stairs.add(mutableListOf(a))
    }

    var currMoney = 1000

    for (stair in stairs) {
        if (stair.size == 1) continue
        val firstPrice = stair.first()
        val lastPrice = stair.last()
        val buyStock = currMoney / firstPrice
        currMoney -= buyStock * firstPrice
        currMoney += buyStock * lastPrice
    }

    val answer = currMoney

    println(answer)
}
