program answer
  implicit none
  integer :: i, N, sum, ka
  integer, allocatable :: A(:)
  read(*,*) N
  allocate(A(N))
  read(*,*) A

  sum=1000
  
  do i = 1, N-1
     if(A(i)<=A(i+1)) then
        sum=int(sum/A(i))*(A(i+1)-A(i))+sum
     end if
  end do

  write(*,*) sum
  
  deallocate(A)
  stop
 end program answer
