#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 5e5 + 7, mod = 1e12 + 7;
int T, n, l;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> T;
while (T--) {
cin >> n >> l;
if (n == 1) cout << 0 << endl;
else cout << ((l / 2 * (l - l / 2)) % mod * ((int)pow(2, (int)log2(n) + 1) - 1)) % mod << endl;
}
return 0;
}
怀疑是取模的问题??
如果解决了能不能讲讲?