function main(arg) {
  let a = parseInt(arg, 10);
  console.log(a + a * a + a * a * a);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
// main("10");
//https://atcoder.jp/contests/abc167/tasks/abc167_b
