2.1 Naman the Explorer
Score: 10pts
Time Limit: 5.00 sec
A group of explorers are studying an ancient underground mine. The mine is built in such a way that each chamber connects to six neighboring chambers through narrow tunnels.
One explorer, Naman, wants to know how far sound can travel inside this mine. If he shouts in a chamber, the sound reaches not only that chamber but also every chamber that can be reached within at most n tunnel steps.
For example, if n = 1, the sound spreads to the current chamber and its 6 directly connected neighbors. If n = 2, the sound covers those plus the next “layer” of chambers around them, and so on.
Your task is to help Naman calculate: given a distance n, how many chambers in total will hear the shout?

Constraints
1 <= n <= 10^9

Input Format
A single line containing an integer n.

Output Format
Output the integer (It may exceed the input constraints).

Example 1
Input:
0

Output:
1

Explanation:
Only the chamber where Naman is standing.

Example 2
Input:
2

Output:
19

Explanation:
1 (starting chamber) + 6 (first layer) + 12 (second layer).

Log In to solve the Question