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

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

    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)
}