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

    var m = 1000L
    var t = 0L

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