import Control.Monad ((>=>))
import Data.Maybe (mapMaybe)
import System.Environment (getArgs)



tryFor :: Int -> Int -> Maybe Int
tryFor s = foldr (>=>) pure $ replicate s step
  where
    step n
      | n `mod` (s - 1) == 0 = Just $ n * s `div` (s - 1) + 1
      | otherwise = Nothing




main :: IO ()
main = do
  args <- getArgs
  let n =
        case args of
          [] -> 5
          s:_ -> read s
      a = head . mapMaybe (tryFor n) $ [n,2 * n ..]
  print a