Social Distancing
题号:NC210237
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Nowadays, the Kingdom of Dreamgrid is suffering from a national pandemic. Fortunately, president Baobao is working effectively with the Center for Disease Control (CDC) and they are trying their best to make everything under control.

President Baobao has announced a policy of Social Distancing to prevent the diffusion of the virus. As the chief of CDC, you are required to research on the following problem:

There are n people who need to be observed and you have already set a monitor in (0,0) on a 2-dimensional plane. Everyone should stay within the distance of r to the monitor. You also have to keep them stay away from each other as far as possible. To simplify the problem, you can only allocate them to integers coordinates.

Please maximize

where d(i,j) means the Euclidean distance between the i-th and the j-th person.

输入描述:

There are multiple test cases. The first line of the input contains an integer T , indicating the number of test cases. 

For each test case, the only line contains two integers n,r .

输出描述:

Please output the answer in one line for each test case.
示例1

输入

复制
2
4 2
5 10

输出

复制
64
2496