// BỘI CHUNG NHỎ NHẤT
// https://l...content-available-to-author-only...u.vn/problem/bcnnlcm
#include<bits/stdc++.h>
#define MAX 1000000
#define MOD 1000000007
using namespace std;
int t, a, b, d[MAX], uoc[MAX];
void sanguoc(int n)
{
for(int i = 1; i <= n; i++)
uoc[i] = 0;
for(int i = 2; i * i <= n; i++)
if(uoc[i] == 0)
for(int j = i * i; j <= n; j += i)
if(uoc[j] == 0) uoc[j] = i;
for(int i = 1; i <= n; i++)
if(uoc[i] == 0) uoc[i] = i;
}
void phantich(int n)
{
while(n > 1)
{
int x = uoc[n];
int dem = 0;
while(n % x == 0)
{
n /= x;
dem++;
}
d[x] += dem;
}
if(n > 1) d[n]++;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#define name "cau4"
if(fopen(name".inp", "r"))
{
freopen(name".inp", "r", stdin);
freopen(name".out", "w", stdout);
}
sanguoc(MAX);
cin >> t;
while(t--)
{
cin >> a >> b;
long long ans = 1;
for(int i = 1; i <= b; i++)
d[i] = 0;
for(int i = a; i <= b; i++)
phantich(i);
for(int i = 2; i <= b; i++)
if(d[i] > 0)
ans = ans * (2 * d[i] + 1) % MOD;
cout << ans << '\n';
}
}
Ly8gQuG7mEkgQ0hVTkcgTkjhu44gTkjhuqRUCi8vIGh0dHBzOi8vbC4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4udS52bi9wcm9ibGVtL2Jjbm5sY20KCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgTUFYIDEwMDAwMDAKI2RlZmluZSBNT0QgMTAwMDAwMDAwNwp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IHQsIGEsIGIsIGRbTUFYXSwgdW9jW01BWF07Cgp2b2lkIHNhbmd1b2MoaW50IG4pCnsKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKQogICAgICAgIHVvY1tpXSA9IDA7CiAgICBmb3IoaW50IGkgPSAyOyBpICogaSA8PSBuOyBpKyspCiAgICAgICAgaWYodW9jW2ldID09IDApCiAgICAgICAgICAgIGZvcihpbnQgaiA9IGkgKiBpOyBqIDw9IG47IGogKz0gaSkKICAgICAgICAgICAgICAgIGlmKHVvY1tqXSA9PSAwKSAgICAgdW9jW2pdID0gaTsKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKQogICAgICAgIGlmKHVvY1tpXSA9PSAwKSAgIHVvY1tpXSA9IGk7Cn0KCnZvaWQgcGhhbnRpY2goaW50IG4pCnsKICAgIHdoaWxlKG4gPiAxKQogICAgewogICAgICAgIGludCB4ID0gdW9jW25dOwogICAgICAgIGludCBkZW0gPSAwOwogICAgICAgIHdoaWxlKG4gJSB4ID09IDApCiAgICAgICAgewogICAgICAgICAgICBuIC89IHg7CiAgICAgICAgICAgIGRlbSsrOwogICAgICAgIH0KICAgICAgICBkW3hdICs9IGRlbTsKICAgIH0KICAgIGlmKG4gPiAxKSAgIGRbbl0rKzsKfQoKaW50IG1haW4oKQp7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwogICAgY2luLnRpZSgwKTsgICAgIGNvdXQudGllKDApOwogICAgI2RlZmluZSBuYW1lICJjYXU0IgogICAgaWYoZm9wZW4obmFtZSIuaW5wIiwgInIiKSkKICAgIHsKICAgICAgICBmcmVvcGVuKG5hbWUiLmlucCIsICJyIiwgc3RkaW4pOwogICAgICAgIGZyZW9wZW4obmFtZSIub3V0IiwgInciLCBzdGRvdXQpOwogICAgfQogICAgc2FuZ3VvYyhNQVgpOwogICAgY2luID4+IHQ7CiAgICB3aGlsZSh0LS0pCiAgICB7CiAgICAgICAgY2luID4+IGEgPj4gYjsKICAgICAgICBsb25nIGxvbmcgYW5zID0gMTsKICAgICAgICBmb3IoaW50IGkgPSAxOyBpIDw9IGI7IGkrKykKICAgICAgICBkW2ldID0gMDsKICAgICAgICBmb3IoaW50IGkgPSBhOyBpIDw9IGI7IGkrKykKICAgICAgICAgICAgcGhhbnRpY2goaSk7CiAgICAgICAgZm9yKGludCBpID0gMjsgaSA8PSBiOyBpKyspCiAgICAgICAgICAgIGlmKGRbaV0gPiAwKQogICAgICAgICAgICAgICAgYW5zID0gYW5zICogKDIgKiBkW2ldICsgMSkgJSBNT0Q7CiAgICAgICAgY291dCA8PCBhbnMgPDwgJ1xuJzsKICAgIH0KCn0K