object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val As = List.fill(N)(in.nextInt)

  def op(ps: List[(Int, Int)], money: Long): Long = ps match {
    case Nil => money
    case (now, next) :: xs =>
      op(xs, if (now <= next) money / now * next + money % now else money)
  }

  println(op(As.zip(As.tail), 1000))
}
