# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Ashik's Trouble

By sakibalamin · Limits 1s, 512 MB

Ashik is generally a good boy. But recently he has had some trouble with one of his classmates. His teacher gave him detention for that. But luckily there is a way to avoid that. Ashik has to solve a problem to earn his freedom from detention. Can you help him to do that?

The teacher gave him a figure like the one given below. There will be one or multiple squares with the same area (in case of multiple squares, all of the squares are identical). You have to find the total area that doesn't belong to more than one square.

Figure with Four Squares, You have to find the area of the ‘green shaded’ portion

## Input

The first line consists of a single Integer T (1 ≤ T ≤ 50) — the number of test cases.

For every test case you will be given an even Integer N (2 ≤ N ≤ 100), the ‘Length of a side’ of a square and an Integer M (1 ≤ M ≤ 100), the number of squares.

## Output

For every test case print an Integer, the total area that doesn't belong to more than one square.
(See the figure for better understandings).

## Sample

InputOutput
2
2 4
4 5

10
48


### Statistics

99% Solution Ratio

FairoozREarliest, Jun '20

FairoozRFastest, 0.0s

Rabiul_cse17Lightest, 0 B

bokaifShortest, 78B