function Main(input) {
    input = input.split("\n");
    const num = Number(input[0]);
    
    console.log(num + num * num + num * num * num);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));