object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val n  = inputs(0).toInt
  val ai = inputs(1).split(" ").map(_.toInt)

  println(solve(n, ai))

  def solve(n: Int, ai: Seq[Int]): Long = {
    var start = ai(0).toLong
    val size  = ai.size
    var money = 1000L
    var stock = 0L
    (1 until size).foreach { i =>
      val currentStockPrice = ai(i).toLong

      if(start < currentStockPrice) {
    
        stock = money / start 
        money = money % start
    
        money = money + (stock * currentStockPrice) 
        stock = 0
        start = currentStockPrice
      } else if (start > currentStockPrice) {
        start = currentStockPrice
      }
      // println(s"仕入れ値: $start")
    }

    money
  }
}