Interesting Square Sum
Time Limit: 1 sec
The Problem
Do you know that there are squares within a square? This might seem confusing, but take a look at this. The given table is vertically and horizontally filling with the number in 1 – n and n – 1 format and n is concentrically decreasing order.
1 |
2 |
3 |
3 |
2 |
1 |
2 |
1 |
2 |
2 |
1 |
2 |
3 |
2 |
1 |
1 |
2 |
3 |
3 |
2 |
1 |
1 |
2 |
3 |
2 |
1 |
2 |
2 |
1 |
2 |
1 |
2 |
3 |
3 |
2 |
1 |
The given square is only for 3.
You can make three squares from the table above. Well there are more but we will consider only concentric squares. The squares are denoted using different color.
In this problem you have to find the sum of the numbers of each square.
For input 3 the sum is
1st square (RED) 1+2+3+3+2+1+2+3+3+2+1+2+3+3+2+1+2+3+3+2 = 44
2nd square (GREEN) 1+2+2+1+2+2+1+2+2+1+2+2=20
3rd square (BLUE) 1+1+1+1=4
Total sum is 44+20+4=68
The Input
There are several lines of input. Each line contain a single positive integer 1<=N<=100. Input is terminated by EOF.
The Output
For each line of input print the total sum of the concentric square.
Sample Input
3
4
Sample Output
68
144
Problem Setter: Milton Deb