process.stdin.resume();
process.stdin.setEncoding('utf8');

var input_lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  input_lines.push(parseInt(line));
});

reader.on('close', () => {
  //console.log(input_lines);
  var a = input_lines[0];
  //console.log(input_lines);
  console.log(a + (a*a) + (a*a*a));

});
