Problem:
Score : 100 points

Problem Statement

Given an integer a as input, print the value a + a^2 + a^3.

Constraints

1 \leq a \leq 10

a is an integer.

Input

Input is given from Standard Input in the following format:

a

Output

Print the value a + a^2 + a^3 as an integer.

Sample Input 1

2

Sample Output 1

14

When a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.

Print the answer as an input. Outputs such as 14.0 will be judged as incorrect.

Sample Input 2

10

Sample Output 2

1110

Solution in Rust (1.42.0) (judge verdict: Accepted)

use std::io::*;
use std::sync::Mutex;

pub struct Scanner {
    source: Mutex<Bytes<BufReader<Stdin>>>,
}

impl Scanner {
    pub fn new() -> Scanner {
        Scanner {
            source: Mutex::new(Read::bytes(BufReader::new(stdin()))),
        }
    }
    pub fn source(&mut self) -> &Mutex<Bytes<BufReader<Stdin>>> {
        return &self.source;
    }
}

#[allow(unused_macros)]
macro_rules! rin {
    ( from $scanner:ident, $( $rep:tt )* ) => {
        let mut locked_stdin = $scanner.source().lock().unwrap();
        #[allow(unused_mut)]
        let mut buf = move || -> String {
            locked_stdin
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        rin_parse!{buf, $($rep)*}
        drop(buf);
    };
}

#[allow(unused_macros)]
macro_rules! rin_parse {
    ( $buf:expr ) => {};
    ( $buf:expr, ) => {};
    ( $buf:expr, $type:tt : $var:tt, $($r:tt)* ) => {
        rin_read!($buf, $type, $var, false);
        rin_parse!($buf, $($r)*);
    };
    ( $buf:expr, mut $type:tt : $var:tt, $($r:tt)* ) => {
        rin_read!($buf, $type, $var, true);
        rin_parse!($buf, $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! rin_read {
    ( $buf:expr, $type:tt, $var:ident, false ) => {
        let $var = read_value!($buf, $type);
    };
    ( $buf:expr, $type:tt, [$($var:ident),*], false ) => {
        $( let $var = read_value!($buf, $type); )*
    };

    ( $buf:expr, $type:tt, $var:ident, true ) => {
        let mut $var = read_value!($buf, $type);
    };
    ( $buf:expr, $type:tt, [$($r:tt)*], true ) => {
        $( let mut $var = read_value!($buf, $type); )*
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ( $next:expr, ( $($t:tt),* ) ) => {
        ( $(read_value!($next, $t)),* )
    };
    ( $next:expr, [ $t:tt ; [$d1:expr, $d2:expr] ] ) => {
        (0..$d1).map(|_| read_value!($next, [$t; $d2])).collect::<Vec<_>>()
    };
    ( $next:expr, [ $t:tt ; $len:expr ] ) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };   
    ( $next:expr, chars ) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ( $next:expr, usize1 ) => {
        read_value!($next, usize) - 1
    };
    ( $next:expr, $t:ty ) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// main function

fn main() {
    let mut sc : Scanner = Scanner::new();
    let t = 1;
    // rin!( from sc, usize : t, );
    for _ in 0..t { solve(&mut sc); }
}

fn solve(sc: &mut Scanner) {
    let out = stdout();
    let mut out = BufWriter::new(out.lock());

    rin! {
        from sc,
        i32 : a,
    }

    write!(out, "{}\n", a + a * a + a * a * a).ok();
}