// https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_d
// TODO: try to AC
// DP使ってやればできそうなんだけど、相変わらず更新のイメージがうまくもてない
// 変数が多すぎて頭がこんがらがってる

fun main() {
    msolutions2020d()
}

fun msolutions2020d() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    var soko = Int.MAX_VALUE
    var yama = Int.MIN_VALUE
    var current = 1000L
    var searchSoko = true
    for (value in a) {
        if (searchSoko) {
            if (soko > value) {
                soko = value
            } else {
                searchSoko = false
                yama = value
            }
        } else {
            if (yama < value) {
                yama = value
            } else {
                searchSoko = true
                if (yama > soko) {
                    val buy = current / soko
                    current += buy * (yama - soko)
                }
                soko = value
                yama = Int.MIN_VALUE
            }
        }
    }
    if (yama > soko) {
        val buy = current / soko
        current += buy * (yama - soko)
    }
    println(current)
}