function Main(input){
  let inputNum = parseInt(input);
  let answer = inputNum + Math.pow(inputNum, 2) + Math.pow(inputNum, 3);
  console.log(answer);
}

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