chotu-and-chocolate-day
Source: hackerearth
Difficulty: MEDIUM

On Chocolate day, Chotu wants to give his girlfriend a box of chocolate. Chotu has a N X N square box and N^2 chocolates each having a distinct sweetness value between 1 and N^2.

To make the box look attractive Chotu must fill each row with chocolates arranged in increasing value of sweetness. Chotu also knows that his girlfriend loves the number K so he wants to maximize the total sweetness of the K^th column.
Help Chotu arrange the chocolate in the box in a way that each row has choclates with increasing value of sweetness and the total sweetness of K^th column is maximized.

As there are multiple ways to arrange chocolates, your task is to tell Chotu the maximum possible sweetness he can have for the K^th column.
Input
 
First line contains integer T denoting number of testcases. 
Each testcase has two integers N and K.

Ouptut

For each test case print answer in single line the maximum possible sweetness Chotu can have for the K^th column.

Constraints

1 ≤ T ≤ 20

1 ≤ N ≤ 10^3

1 ≤ K ≤ N

SAMPLE INPUT
1
4 1

SAMPLE OUTPUT
28

Explanation

For the given sample case one possible arrangement of chocolates is

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
The total sweetness of first column is 28.