fun main() = SimpleFastIO().exec {
    fun Int.pow(p: Int): Int {
        var x = 1
        for (i in 0 until p) x = Math.multiplyExact(x, this)
        return x
    }

    val a = readLine().toInt()

    val answer = a + a.pow(2) + a.pow(3)

    println(answer)
}

@Suppress("unused", "HasPlatformType")
class SimpleFastIO {
    private val br: java.io.BufferedReader = System.`in`.bufferedReader()
    private val sb: StringBuilder = StringBuilder()
    fun readLine() = br.readLine()!!
    fun println() = sb.appendln()
    fun print(any: Any) = sb.append(any)
    fun println(any: Any) = sb.appendln(any)
    fun <T> print(any: Iterable<T>, separator: String) = sb.append(any.joinToString(separator))
    fun <T> println(any: Iterable<T>, separator: String) = sb.appendln(any.joinToString(separator))
    fun exec(action: SimpleFastIO.() -> Unit) = run { action() }.run { kotlin.io.println(sb) }
}
