program main
  implicit none
  integer i,Mst, Mcash, N
  integer,allocatable :: A(:)
  read(*, *) N
  allocate(A(N))
  read(*, *) (A(i), i = 1,N)
  Mst = 0
  Mcash = 1000
  do i = 1,N-1
    if (A(i) > A(i+1)) then
      Mcash = Mcash + A(i)*Mst
      Mst = 0
    else
      Mst = Mst + Mcash/A(i)
      Mcash = Mcash-(Mcash/A(i))*A(i)
    end if
  end do
  Mcash = Mcash + A(N)*Mst
  write(*, *) Mcash
end program main
