Practice on Toph

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

Enormous Product

By YouKnowWho · Limits 4s, 512 MB

You are given two integers l and r. You need to find the value of
Enormous Product

As the value of this equation may be large, you need to find its remainder modulo (109+7).

Input

The first line will contain an integer t(1 ≤ t ≤ 5), the number of test cases.

Each of the next t lines will contain two integers l and r (1 ≤ l ≤ r ≤ 109).

Output

Find the value of the aforementioned product modulo (109+7).

Sample

InputOutput
2
1 2
100 100
8
409005006


    Discussion
    Statistics

    60% Solution Ratio

    SwampFireEarliest, 1M ago

    elekfjaFastest, 0.4s

    SwampFireLightest, 131 kB

    elekfjaShortest, 3958B

    Submit

    Login to submit