'use strict';

function Main(input) {
    const A = Number(input.trim().split('\n')[0]);
    console.log(String(A + A * A + A * A * A));

    return;
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
