Nobita’s teacher gave him a Sequence ( ai ) of natural numbers as homework which is defined as follows:
a1 = 1
a2 = 10
ai = ai−1 + 2ai−2
Now his teacher ask to compute am + am+1 + am+2 + ... + an for given m ≤ n and output it modulo 109 +7. As Nobita is very weak in Mathematics so he asks Doraemon for his help. But Doraemon has to go to date with Mii Chan so he is asking for your help. Can you help Doraemon with this given task.
Input:
First line contain T i.e., no. of test cases.
Each test-case contains two space separated integers m and n as described in the problem.
Output:
Exactly T lines, one for each test case: (am + am+1 + am+2 + ... + an) modulo 109 +7.
Constraints:
Subtask 1: 20 points
1 ≤ T ≤ 10
1 ≤ m ≤ n < 105
Subtask 2: 60 points
1 ≤ T ≤ 1000
1 ≤ m ≤ n < 1016