function Main(input) {
  input = input.trim().split("\n").map(function(x) { return x.split(" ")});
  var a = parseInt(input[0]);
  var ans = a + a*a + a*a*a;
  console.log(ans);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
