fun main() {
    val builder = StringBuilder()

    val a = readInputLine().toInt()

    builder.appendln(a + a * a + a * a * a)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
