"use strict";

const main = arg => {
    const inputList = arg.trim().split("\n");
    // 回答を記述
    const N = parseInt(inputList[0].split(" ")[0]);
    const sum = N + N ** 2 + N ** 3;

    console.log(sum)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));