This page is still under construction.

Parts of this page are still being built. What you see may change.

Puzzle

Time limit1sMemory limit512 MB

Summary
Count rotation-distinct square puzzle pieces whose sides are each smooth, one of k tabs, or one of k blanks, classified into corners, borders, and normals.
Level

Medium6 of 10

Topics
Combinatorics, Math, Brute force, Implementation
Solved
No attempts yet

Problem

Andrew is going to open his own factory for manufacturing puzzle pieces. He needs to order a special device that would cut pieces out of cardboard sheets. He also needs to order a set of tips for it. Each tip allows cutting pieces of a particular form.

A puzzle piece is a square, and each of its four sides can contain a rounded tab, a blank cut, or be smooth. The pieces can be of three different types:

  • Corners: such pieces have exactly two adjacent smooth sides forming a corner.
  • Borders: such pieces have exactly one smooth side.
  • Normal: such pieces have no smooth sides.

Rounded tabs and blank cuts can each be of kk types. So there are 2k+12k+1 options for a puzzle piece side: a rounded tab of one of kk types, a blank cut of one of kk types, or a smooth side.

Andrew needs to find out how many different tips he needs to order. Pieces such that one of them can be rotated to become equal to another one can obviously be cut out using the same tip.

Help Andrew find the number of different tips he needs to order so that he would be able to cut any possible puzzle piece.

Input

The only line of input contains an integer kk, the number of different rounded tab and blank cut types (1≤k≤1041 \le k \le 10^4).

Output

Output the number of different tips Andrew needs to order.

Notes

All 1818 tips for k=1k = 1 are presented in the picture below:

Examples1

  1. Example 1

    Input
    1
    
    Expected output
    18