fun main (args:Array<String>){
    val inputNum = readLine()!!.toDouble()
    val numPow2 = Math.pow(inputNum,2.0)
    val numPow3 = Math.pow(inputNum,3.0)
    val outputNum = inputNum + numPow2 + numPow3
    print(outputNum.toInt())
}