The year is coming to an end and Quera company plans to make the facade of its building…
- User
The year is coming to an end and Quera company plans to make the facade of its building attractive. Other companies, with Quera as their model, make a similar decision. View of each building n n floors wide m m from n x m n×m formed window means view of each floor of m m consecutive windows with a width of 1 are formed.
Now, companies want to paint all their windows, and to paint each window, they can use only 4 colors, red, blue, green, and yellow, but note that every painting is not eye-catching, and it is an eye-catching painting that no two windows share the same color. Don't have! We say that two windows are shared if at least one of the 4 corners of a window is also a corner of another window.
Description of the image
Now the manager of every company wants to know how many eye-catching colors there are for the facade of his company! Since this number may be large, the remainder of the answer is 1 0 9 + 7 10 9 Output +7.
input In the first line t t represents the number of companies. 1 ≤ t ≤ 200 , 000 1≤t≤200,000 in t t next line in each of two numbers respectively n i n i and m i m i It comes to show the number of floors and width of the company respectively i is i 1 ≤ n i , m i ≤ 500 , 000 1≤n i , m i ≤500,000
output on the line i iam from t t Output the output line of the problem answer.
Example Sample entry 1 4 1 3 2 2 3 3 187563 196327 Plain text Sample output 1 36 24 72 814094109 write in c++
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.