module Main where

import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInteger

getInt = readInt <$> BS.getLine

main :: IO ()
main = do
  n <- getInt
  print $ n + n^2 + n^3