const Main = input => {
    input = input.trim();
    const a = parseInt(input, 10);

    const result = a + a ** 2 + a ** 3;
    console.log(result);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));