P20518 [HackerEarth] Tiwari is very much obsessed with prime numbers. One day he thought to calculate the lowest prime factor of various numbers.
普及
题目描述

Tiwari is very much obsessed with prime numbers. One day he thought to calculate the lowest prime factor of various numbers.
While doing so he came across some numbers called prime number and assumed 0 to be their lowest prime factor (although it's not as we know).
Now ,he gave Anmol (who is Tiwari's competitor) two positive integers L and R and challenged him to calculate the total sum of lowest prime factor of all numbers between L and R (both inclusive).
Now Anmol being a bright student needs your help to finish Tiwari's task. Will you help Anmol?

Since the answer can be very large print your answer modulo (10^9+7).

Input:

First line contains T (no of test cases).

Next T lines contains two positive integers L and R .

Output:

Print T lines of output each containing answer according to the problem statement.

constraints:

1 ≤ T ≤ 10^5

2 ≤ L ≤ R ≤ 10^6

SAMPLE INPUT
2
2 8
3 9

SAMPLE OUTPUT
6
9

Explanation

Test case #1:

numbers in range[2,8] are 2,3,4,5,6,7,8
their lowest prime factors (according to problem statement )are (0,0,2,0,2,0,2) respectively
total sum=0+0+2+0+2+0+2

输入格式

见题面

输出格式

见题面

样例输入
123 11747 22845 4690 10891 2894 20329 16970 46130 14531 24380 3133 14690 30476 57580 23674 35279 25352 34196 30177 57609 3766 29950 29591 45843 12431 16139 4863 26750 23833 47231 23014 25082 32441 56161 27902 39799 32712 49867 10894 18100 23274 55884 23911 46431 1435 22709 7194 27304 26891 40571 10344 11356 23852 36744 25338 27512 23049 32917 10067 23626 21337 53253 9218 38397 29268 49721 796 4542 8645 14696 30441 57672 8289 24829 32478 62725 3415 25701 30923 51616 9000 18799 21078 21795 5305 34340 28328 35719 16551 27161 5222 21205 11994 29514 30691 48822 3165 9846 13716 27537 6508 33520 20676 20766 15823 43518 2696 25729 14183 20907 9462 25062 5895 6945 26258 38286 32645 58500 29193 31856 23312 44613 17954 37969 31427 44029 31217 45909 21627 39111 2382 16160 21222 26387 17797 39781 27613 58369 15951 43015 28916 58936 14081 42665 20047 41023 31748 57292 11191 11862 11397 24419 9196 30665 19565 41195 1597 31696 12948 33546 22103 41438 10033 23194 32347 42369 18070 32079 26419 46517 31770 39876 27429 57276 10582 17179 22184 23930 19860 24079 27511 57163 16772 36239 6629 26968 23345 45271 25712 56433 3636 29956 8600 17001 23591 50224 4082 30186 10589 27658 28792 48585 18896 21481 6947 29671 23131 39530 16828 20355 14890 29318 21743 27411 14446 38949 16289 40350 19029 46146 27779 49041 23865 34932 18919 29466 6424 14867 16339 34813 10052 38088 19540 37613 20827 40102 14869 20584 3194 18376 9520 27399 17582 46944 16964 48478
样例输出
124718 162267 285307 95747 93591 75899 117382 227616 126429 111855 8255 146461 240065 219612 201653 28339 115639 70916 24192 194054 74556 229675 250768 12153 213913 114497 252115 255371 133712 140646 69439 17035 15920 126845 69405 214094 169240 44720 292833 200542 46751 119797 139098 99117 210875 136927 127556 22696 28012 12444 67412 258942 58748 209450 115959 202741 103547 113018 53387 48762 181236 153402 251398 33618 185921 225472 54428 71498 271222 108781 179127 75033 130042 105109 155400 216409 93586 47863 214022 68671 93076 101229 124309 125395 6913 2968 8766 31924 70752 37969 13214 145671 74450 203723 113954 95634 82924 214113 192068 114068