Contest Duration: - (local time) (100 minutes) Back to Home
A - Weird Function /

Time Limit: 2 sec / Memory Limit: 1024 MB

問題文

ただし、答えは 2 \times 10^9 以下の整数であることが保証されます。

制約

• t0 以上 10 以下の整数である

入力

t


入力例 1

0


出力例 1

1371


• f(t) = t^2 + 2t + 3 = 0 \times 0 + 2 \times 0 + 3 = 3
• f(t)+t = 3 + 0 = 3
• f(f(t)+t) = f(3) = 3 \times 3 + 2 \times 3 + 3 = 18
• f(f(t)) = f(3) = 18
• f(f(f(t)+t)+f(f(t))) = f(18+18) = f(36) = 36 \times 36 + 2 \times 36 + 3 = 1371

入力例 2

3


出力例 2

722502


入力例 3

10


出力例 3

1111355571


Score : 100 points

Problem Statement

Let us define a function f as f(x) = x^2 + 2x + 3.
Given an integer t, find f(f(f(t)+t)+f(f(t))).
Here, it is guaranteed that the answer is an integer not greater than 2 \times 10^9.

Constraints

• t is an integer between 0 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

t


Output

Print the answer as an integer.

Sample Input 1

0


Sample Output 1

1371


The answer is computed as follows.

• f(t) = t^2 + 2t + 3 = 0 \times 0 + 2 \times 0 + 3 = 3
• f(t)+t = 3 + 0 = 3
• f(f(t)+t) = f(3) = 3 \times 3 + 2 \times 3 + 3 = 18
• f(f(t)) = f(3) = 18
• f(f(f(t)+t)+f(f(t))) = f(18+18) = f(36) = 36 \times 36 + 2 \times 36 + 3 = 1371

Sample Input 2

3


Sample Output 2

722502


Sample Input 3

10


Sample Output 3

1111355571