CodeForces - 630D

Hexagons!


Time Limit: 500MS

 

Memory Limit: 65536KB

 

64bit IO Format: %I64d & %I64u


Submit Status


Description



After a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known "Heroes of Might & Magic". A part of the game is turn-based fights of big squadrons of enemies on infinite fields where every cell is in form of a hexagon.

Some of magic effects are able to affect several field cells at once, cells that are situated not farther than n

It is easy to see that the number of cells affected by a magic effect grows rapidly when n increases, so it can adversely affect the game performance. That's why Petya decided to write a program that can, given n, determine the number of cells that should be repainted after effect application, so that game designers can balance scale of the effects and the game performance. Help him to do it. Find the number of hexagons situated not farther than ncells away from a given cell.




Input



The only line of the input contains one integer n (0 ≤ n ≤ 109).


Output



Output one integer — the number of hexagons situated not farther than n


Sample Input



Input



2



Output



19


Source


Experimental Educational Round: VolBIT Formulas Blitz


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#define INF 0x3f3f3f3f
#define ll long long
#define N 10010
#define M 1000000007
using namespace std;
int main()
{
	ll n;
	while(scanf("%lld",&n)!=EOF)
	{
		ll sum=n*(n+1)*3+1;
		printf("%lld\n",sum);
	}
	return 0;
}