import java.util.*
import kotlin.math.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main() {
    val n = readInt()
    val a = readInts()

    fun f(m: Long, s: Long, i: Int): Long {
        if (i >= a.size) {
            return m
        }
        val amount = m / a[i]

        return maxOf(f(m, s, i + 1),
            f(m - amount * a[i], s + amount, i + 1), // buy
            f(m + s * a[i], 0, i + 1)) // sell
    }

    println(f(1000, 0, 0))
}
