
fun main(args: Array<String>) {
    // var numberTests = readLine()!!.toInt()
    // var results = mutableListOf<String>()

    // for (i in 0..numberTests-1) {
    var tmpLine = readLine()

    
    val result = experiment(tmpLine!!.toInt())
    // results.add(result)
    // }

    // for (result in results) {
        println(result)
    // }
}

fun experiment(a: Int) : String {

    var result = a + a * a + a * a * a

    return result.toString()
}