'use strict';

const inputs = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
const sMpI = (str) => str.split(' ').map(v => parseInt(v, 10));
const pI = v => parseInt(v, 10);

const number = pI(inputs.shift());

console.log(number + number ** 2 + number ** 3);