Problems
10125 - Magic Square
SUBMIT PROBLEM

Magic Square

Time Limit: 1 sec

 

The Problem

A magic square of order n is an arrangement of n^2 numbers, usually distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant. A magic square contains the integers from 1 to n^2.


There is a thing called magic number in magic square. As for example for 3X3 grid magic number is 15. For 5x5 grid the magic number 65   

 

 

Now you have the write a program to find out magic number of a given grid.

 

The Input

You will be given the value of N(1<=N<=2000) and the value of N will always be an Odd number. N means order of the grid is N and the square grid will be (NxN). Input is terminated by EOF.

 

The Output

For each line of input you have to print the magic number of given (NxN) grid and in a separate line.

 

Sample Input

3

5

 

Sample Output

15

65

 

 

 

[University Level]

Inter School & College Programming Contest (ISCPC) 2017

Problem Setter: Parag Paul