square :: Int -> Int
square n = n * n

cube :: Int -> Int
cube n = n * n * n

addThree :: Int -> Int -> Int -> Int
addThree x y z = x + y + z

calc :: Int -> Int
calc n = addThree n (square n) (cube n)

toInt :: (String -> Int)
toInt x = read x :: Int

main = getLine >>= putStrLn . show . calc . toInt