import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()
    var arr = scan.nextLine().split(" ").map{ it.trim().toInt() }.toTypedArray()

    var buy = 0
    var money = 1000
    var count = 0
    var remain = 0
    var xsell = Int.MAX_VALUE
    for(x in arr)
    {
        if(count==0 && x<xsell)
        {
            buy = x
            count = (money/x)
            remain = money - (count*x)
            //println("$x buy $money $count $remain")
        }
        else if (x>buy && count>0)
        {
            money = (count*x) + remain
            count = 0
            //println("$x sell $money $count $remain")
            xsell = x
        }
    }

    if(money==(arr[0]*count))
        println("1000")
    else
        println(money)
}
