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 (money, stock) = foldr step (1000, 0) (dropLast 1 a `zip` drop 1 a)
  print $ money + stock * (a!!(length a - 1))

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