Area#12429

Area

1 second
256 megabytes
Very easy

You are given squares, each with a side length of . The squares are placed sequentially on a 2D plane such that they are all horizontally aligned. For every square (where 2 \le i \le n), its leftmost edge passes exactly through the center of the (i-1)_{\mathsf{th}} square. mod 1e4+7 Calculate the total integer area occupied by the union of all squares.

Input

The first line of each test case contains single integer (1 \le t \le 10^4) — the number of test cases.

The only line of each test case contain two integers (1 \le n,m \le 100) — the number of squares and the side length of each respectively.

Output

For each test case, Output the total area mod 1e4+7.

Examples

Example 1

Loading
Loading

Scoring

  1. Subtask ( points) : No additional constraints