#include #include #include #include #include #define mp make_pair #define pb push_back #define LL long long #define inf 2e9 #define zeros x^(x-1)&x #define MOD 1000000007 using namespace std; int X,Y,rez,n; long calc(int x,int y,int k) { int rez = 0; if (y>1) rez += calc(x/2,y/2,k*2); if (x==0) { k = Y-k+1; return (1LL * rez + ((1LL*k*(k+1) / 2) % MOD))%MOD; } else if (x==1) { k = max(0,min(k*2-1,Y) - X+1); return (1LL * rez + ((1LL*k*(k+1) / 2) % MOD))%MOD; } else return rez; } int main() { int t; cin>>t; while (t--) { cin>>X>>Y; cout<