fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }

    var isDropping = true
    var cash = 1000
    var stocks = 0

    for (i in 0 until n-1) {
        if (isDropping && aa[i] < aa[i+1]) {
            // cheapest atm
            stocks += cash / aa[i]
            cash -= (cash / aa[i]) * aa[i]
            isDropping = false

        } else if (!isDropping && aa[i] > aa[i+1]) {
            // highest atm
            cash += stocks * aa[i]
            stocks = 0
            isDropping = true
        }
    }

    // sell all the rest
    cash += stocks * aa[n-1]
    println(cash)
}