Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Melencolia I

By ishtupeed · Limits 1s, 512 MB

According to Wikipedia, Albrecht Dürer (May 21, 1471 - April 6, 1528) was a German painter, printmaker, and theorist of the German Renaissance. His famous engraving “Melencolia I”, as shown in the figure above, contains references to carpentry, alchemy, geometry, numerology, and many other disciplines. It has been the subject of more scholarship than probably any other print. In the engraving, a square with an interesting property can be seen. The square is shown below:

The sum of the values in each row and each column is equal to 34. Even the sums of the values in the main diagonal and the anti-diagonal are 34. This type of square is also known as Magic Square.

In this problem, your task is to find out the number of ways to fill a 4×44\times 4 grid to make Magic Squares. Two Magic Squares are considered different if they differ by at least one cell. To keep the problem simple, you will be given an integer NN. You need to construct the Magic Square using integers in the range [0,N][0, N]. You can use any integer as many times as you want.

Input

The input will contain a single integer, N(0N10)N (0 \leq N \leq 10) denoting the range.

Output

Print one integer denoting the possible number of different Magic Squares.

Sample

InputOutput
1
34

    Discussion

    Statistics


    39% Solution Ratio

    BigBagEarliest, 6M ago

    amin21Fastest, 0.0s

    BigBagLightest, 131 kB

    robiul580Shortest, 221B

    Submit

    Login to submit

    Editorial

    Consider the values in the grid as variables: Using the properties of the magic square, we can write...

    Related Contests

    Toph uses cookies. By continuing you agree to our Cookie Policy.