408871: GYM103366 K Many Littles Make a Mickle

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Many Littles Make a Mickletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Gather sand to form a tower is a Chinese idiom, whose Pinyin is $$$j\grave{u}\ sh\bar{a}\ ch\acute{e}ng\ t\check{a}$$$. It means to pile sand into a pagoda, referring that a little makes a lot. From the fahua Sutra - convenience products.

Suppose the tower has $$$N$$$ floors. There are $$$i\times i$$$ rooms on the $$$i^\text{th}$$$ floor. Each room can accommodate $$$M$$$ people. How many people can the $$$N$$$ floor tower accommodate?

Input

The first line is a positive integer $$$T\ (1 \le T \le 100)$$$, indicating that there are $$$T$$$ test data.

Next, there are $$$T$$$ lines. Each line has two positive integers $$$N$$$ and $$$M\ (1 \le N,M \le 100)$$$, indicating the number of floors of the tower and the number of people that can be accommodated in each room in a test data.

Output

Each test data outputs a line containing one positive integer, that is, the total number of people that can be accommodated in the $$$N$$$ floor tower.

ExampleInput
2
2 2
3 3
Output
10
42

加入题单

算法标签: