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

    var firstBuy = -1
    var lastSell = -1
    val b = BooleanArray(n) { false }
    val s = BooleanArray(n) { false }
    repeat(n) {
        if (it < n-1) {
            if (a[it] > a[it+1]) {
                // 売る
                lastSell = it
                s[it] = true
            } else if (a[it] < a[it+1]) {
                // 買う
                if (firstBuy == -1) firstBuy = it
                b[it] = true
            }
        }
    }
    var m = 1000
    var t = 0
    repeat(n) {
        if (b[it]) {
            t = m/a[it]
            m -= t*a[it]
        }
        if (s[it]) {
            m += t*a[it]
            t=0
        }
    }
    if (t > 0) m += t*a[n-1]
    println(m)
}