"use strict"
function main(arg) {
    let n = arg.trim().split("\n")[0]
    n = Number(n)
    console.log(
        n + n * n + n * n * n
    )
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));