303241: CF630D. Hexagons!

Memory Limit:64 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hexagons!

题意翻译

在下图六边形网格当中,求离中间六边形距离不超过n的六边形的个数. Translated by @@Fuko_Ibuki

题目描述

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 $ cells away from the cell in which the effect was applied. The distance between cells is the minimum number of cell border crosses on a path from one cell to another. 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 $ n $ cells away from a given cell. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF630D/b73bc98c088fe19987a12ad8929090ba13c1d4a0.png)

输入输出格式

输入格式


The only line of the input contains one integer $ n $ ( $ 0<=n<=10^{9} $ ).

输出格式


Output one integer — the number of hexagons situated not farther than $ n $ cells away from a given cell.

输入输出样例

输入样例 #1

2

输出样例 #1

19

Input

题意翻译

在下图六边形网格当中,求离中间六边形距离不超过n的六边形的个数. Translated by @@Fuko_Ibuki

加入题单

上一题 下一题 算法标签: