4878: 六边形!

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:13 通过:3

题目描述

    IT City的游戏开发公司试用期后,Petya加入了一组程序员,该程序员开发了一款类似于著名的门与魔法英雄的新回合策略游戏。游戏的一部分是大型敌人中队在无限的场地上进行的回合战斗,每个单元格都是六边形的形式。

    一些魔术效果能够同时影响多个单元格,这些单元格距离应用效果的单元格不超过n单元格。像元之间的距离是从像元到另一个像元的路径上的最小单元格边框交叉数。

    很容易看出,当n增加时,受魔法效果影响的单元格数量会迅速增长,因此会对游戏性能产生不利影响。这就是为什么Petya决定编写一个程序,该程序可以在给定n的情况下确定效果应用后应重新绘制的单元格数量,以便游戏设计师可以平衡效果的规模和游戏性能。帮助他去做。查找距离给定单元格不超过n个单元格的六边形数量。

    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.

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 cells away from a given cell.
Examples
Input
2
Output
19

输入格式

输入的唯一一行包含一个整数n (0≤n≤109).

输出格式

输出一个整数 距离给定单元格不远于n个单元格的六边形数。

输入样例:

2

输出样例:

19


输入样例 复制

2

输出样例 复制

19