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

    var m = 1000L
    var t = 0L

    repeat(n-1) {
        if (a[it] > a[it+1]) {
            if (t > 0L) {
                m += t * a[it]
                t = 0L
            }
        } else if (a[it] < a[it+1]) {
            if (m > a[it]) {
                t += m / a[it]
                m -= t * a[it]
            }
        }
    }
    if (t > 0L) m += t*a[n-1]
    println(m)
}