Problem : Clockwise Bricks Breaker
Clockwise Bricks Breaker is a game where there is a ball which is used to break the block of bricks. Brick's Blocks are always in a form of a square matrix( e.g 2X2, 4X4). The ball has some characteristics like for breaking each brick from the block. It consumes 1 unit of energy and the whole setup is in a manner that the ball will break bricks always  in clock wise direction, in a ring fashion and start from topleft. Take an example of 4X4 brick block.
Figure 1.
Figure 2.
Figure 3.
The numbers on the bricks are nothing but points gained by breaking that brick which is assigned row wise starting from 1 to NxN. The game gets over when energy of ball exhausts and once ball initiated with some energy it will only stop when all its energy exhaust.
Your Task is to calculate total points (points of a block should be the positional value of that block as mentioned in the picture: You have to add points of all the broken bricks) gained by a player, where the energy of ball and size of block will be given.
Your Task is to calculate total points (points of a block should be the positional value of that block as mentioned in the picture: You have to add points of all the broken bricks) gained by a player, where the energy of ball and size of block will be given.
Input Format:
First line of input should be the number of test cases T
Next T lines contain two variables N and E delimited by a whitespace where,
First line of input should be the number of test cases T
Next T lines contain two variables N and E delimited by a whitespace where,
 N =size of square block (i.e. block will be of NXN bricks)
 E =Energy of ball
Output Format:
Output will be T lines containing the integer which is total number points gained by that energy.
Output will be T lines containing the integer which is total number points gained by that energy.
OR
Print "Invalid Input" if constraint fails
Print "Invalid Input" if constraint fails
Constraints:
 0< T<=10
 0< N <=200
 0<= E <=N*N
Example
Example Number

Sample Input

Sample Output

Explaination

1

2
4 5 1 50 
36 Invalid Input 
For first test case as with Energy 5, the ball will break 5 bricks having points 1,4,16,13,2
So 1+4+16+13+2=36. Second test case is Invalid Input because constraint E<=N*N not satisfied. 
2

2
5 0 9 3 
0 Invalid Input 
For first test case it is 0 as energy is zero.
For second test case it is Invalid Input because constraint E >= 0 not satisfied. 