import java.math.BigInteger

fun main() {
    val a = readInt()
    println(a + (a `**` 2) + (a `**` 3))
}

infix fun Int.`**`(exponent: Int): Int {
    return BigInteger.valueOf(this.toLong()).pow(exponent).toInt()
}

// Input Reader
private fun readLn() = readLine()!!

private fun readInt() = readLn().toInt()
