import Data.List
dropLast n l = take ((length l) - n) l

x -: f = f x

getInt = (fmap read) getLine :: IO Int
getInts = ((fmap ((fmap read) . words)) getLine) :: IO [Int]
main = do
  n <- getInt
  a <- getInts
  let (cash, stock) = foldl step (1000, 0) (dropLast 1 a `zip` drop 1 a)
  print $ cash + stock * (last a)

step (cash,stock) (today,tomorrow) =
  if (stock > 0) && (today > tomorrow)
    then (cash + stock * today, 0)
    else if (stock == 0) && (today < tomorrow)
      then (cash `mod` today, cash `div` today)
      else (cash,stock)
