Codeforces Round 832 (Div. 2) |
---|
Finished |
For given integers $$$n$$$ and $$$m$$$, let's call a pair of arrays $$$a$$$ and $$$b$$$ of integers good, if they satisfy the following conditions:
Find the sum of $$$|a|$$$ over all good pairs of arrays $$$(a,b)$$$. Since the answer can be very large, output it modulo $$$10^9 + 7$$$.
The input consists of multiple test cases. The first line contains a single integer $$$t (1 \leq t \leq 10^4)$$$ — the number of test cases. The description of the test cases follows.
The only line of each test case contains two integers $$$n$$$ and $$$m$$$ $$$(1 \leq n, m \leq 5 \cdot 10^6)$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5 \cdot 10^6$$$ and the sum of $$$m$$$ over all test cases does not exceed $$$5 \cdot 10^6$$$.
For each test case, output a single integer — the sum of $$$|a|$$$ over all good pairs of arrays $$$(a,b)$$$ modulo $$$10^9 + 7$$$.
41 11 22 2100 100
8 26 101 886336572
In the first testcase, the good pairs of arrays are
Hence the sum of the lengths would be $$${2 + 3 + 3} = 8$$$.
Name |
---|