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 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
数列,问的是周围到0的有多少个
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x7fffffff
#define INF 0x7fffffffffffffff
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
LL powl(LL x, LL n)
{
LL pw = 1;
while (n > 0)
{
if (n & 1) // n & 1 等价于 (n % 2) == 1
pw *= x;
x *= x;
n >>= 1; // n >>= 1 等价于 n /= 2
}
return pw;
}
LL n;
int main()
{
cin>>n;
cout<<n*(6+6*n)/2+1<<endl;
return 0;
}

  

最新文章

  1. Java基础-多线程编程-1.随便选择两个城市作为预选旅游目标。实现两个独立的线程分别显示10次城市名,每次显示后休眠一段随机时间(1000ms以内),哪个先显示完毕,就决定去哪个城市。分别用Runnable接口和Thread类实现。
  2. 教你一招:win 7 或win 10右键菜单 添加获取管理员权限
  3. font-family 字体
  4. OGNL和ValueStack
  5. 用DOM4J解析XML文件案例
  6. hdu 1261 字串数
  7. 【hdu3579-Hello Kiki】拓展欧几里得-同余方程组
  8. XMPP——Smack[2]会话、消息监听、字体表情和聊天窗口控制
  9. Winform中修改WebBrowser控件User-Agent的方法(已经测试成功)
  10. ASP.NET Core身份验证服务框架IdentityServer4-整体介绍
  11. nginx + tomcat + redis 部署项目,解决session共享问题。
  12. ECMAScript中的两种属性
  13. kindle 安卓 app下载的电子书放在什么文件夹?
  14. java 运算符的优先级比较
  15. 小patch(psu)的打法 -- 实例
  16. 在 子 iframe中 点击一个按钮, 变换 这个 iframe的地址url.
  17. 安装部署Jenkins服务
  18. Nutch1.2 的安装与使用
  19. DLL中获取主程序句柄
  20. Nginx+Tomcat+Memcache实现负载均衡及Session共享

热门文章

  1. 百度地图SDK v2.1.2使用方法
  2. 第5章 使用MUI与H5+构建移动端app
  3. CentOS 7 下设置DNS
  4. ES6中变量的解析赋值的用途
  5. 我们为什么要在C++中使用虚函数
  6. ueditor 1.2.6使用方法
  7. Opencv Laplacian(拉普拉斯算子)
  8. 【转】nginx location匹配规则
  9. tar打包tar.gz文件
  10. redis系列:集群