#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = (ll)1e9 + 7;
ll even = 0L, odd = 0L;
ll solve(ll lrc)
{
ll p, n;
for(p = 1L, n = 0L; p - 1 < lrc; p *= 2, n++) ;
n--;
// cout << n << "v" << p << endl;
if(p - 1 != lrc) n--, p /= 2;
// cout << n << endl;
if(n % 2){
ll rest = (lrc - p + 1);
p /= 2;
ll tmp = p * 4;
even = tmp - 2;
even /= 3;
// cout << even << endl;
tmp = even;
even = (tmp * tmp) % MOD + tmp;
even %= MOD;
p /= 2;
tmp = (p * 4) % MOD;
odd = tmp - 1;
odd /= 3;
odd += rest;
odd %= MOD;
odd *= odd;
odd %= MOD;
}
else{
ll rest = (lrc - p + 1);
p /= 2;
ll tmp = p * 4;
odd = tmp - 1;
odd /= 3;
odd *= odd;
odd %= MOD;
p /= 2;
tmp =(p * 4) % MOD;
even = tmp - 2;
even /= 3;
even += rest;
tmp = even;
even = ((tmp * tmp) % MOD + tmp) % MOD;
}
// cout << even << " " << odd << endl;
return (odd + even) % MOD;
}
int main()
{
ll l, r;
cin >> l >> r;
ll res = (solve(r) - solve(l - 1)) % MOD;
if(res < 0) res += MOD;
cout << res << endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCmNvbnN0IGxsIE1PRCA9IChsbCkxZTkgKyA3OwoKbGwgZXZlbiA9IDBMLCBvZGQgPSAwTDsKCmxsIHNvbHZlKGxsIGxyYykKewogICAgbGwgcCwgbjsKICAgIGZvcihwID0gMUwsIG4gPSAwTDsgcCAtIDEgPCBscmM7IHAgKj0gMiwgbisrKSA7CiAgICBuLS07CiAgICAvLyBjb3V0IDw8IG4gPDwgInYiIDw8IHAgPDwgZW5kbDsKICAgIGlmKHAgLSAxICE9IGxyYykgbi0tLCBwIC89IDI7CiAgICAvLyBjb3V0IDw8IG4gPDwgZW5kbDsKICAgIGlmKG4gJSAyKXsKICAgICAgICBsbCByZXN0ID0gKGxyYyAtIHAgKyAxKTsKCiAgICAgICAgcCAvPSAyOwogICAgICAgIGxsIHRtcCA9IHAgKiA0OwogICAgICAgIGV2ZW4gPSB0bXAgLSAyOwogICAgICAgIGV2ZW4gLz0gMzsKICAgICAgICAvLyAgY291dCA8PCBldmVuIDw8IGVuZGw7CiAgICAgICAgdG1wID0gZXZlbjsKICAgICAgICBldmVuID0gKHRtcCAqIHRtcCkgJSBNT0QgKyB0bXA7CiAgICAgICAgZXZlbiAlPSBNT0Q7CiAgICAgICAgcCAvPSAyOwogICAgICAgIHRtcCA9IChwICogNCkgJSBNT0Q7CiAgICAgICAgb2RkID0gdG1wIC0gMTsKICAgICAgICBvZGQgLz0gMzsKICAgICAgICBvZGQgKz0gcmVzdDsKICAgICAgICBvZGQgJT0gTU9EOwogICAgICAgIG9kZCAqPSBvZGQ7CiAgICAgICAgb2RkICU9IE1PRDsKICAgIH0KICAgIGVsc2V7CiAgICAgICAgbGwgcmVzdCA9IChscmMgLSBwICsgMSk7CiAgICAgICAgcCAvPSAyOwogICAgICAgIGxsIHRtcCA9IHAgKiA0OwogICAgICAgIG9kZCA9IHRtcCAgLSAxOwogICAgICAgIG9kZCAvPSAzOwogICAgICAgIG9kZCAqPSBvZGQ7CiAgICAgICAgb2RkICU9IE1PRDsKICAgICAgICBwIC89IDI7CiAgICAgICAgdG1wID0ocCAqIDQpICUgTU9EOwogICAgICAgIGV2ZW4gPSB0bXAgLSAyOwogICAgICAgIGV2ZW4gLz0gMzsKICAgICAgICBldmVuICs9IHJlc3Q7CiAgICAgICAgdG1wID0gZXZlbjsKICAgICAgICBldmVuID0gKCh0bXAgKiB0bXApICUgTU9EICsgdG1wKSAlIE1PRDsKCiAgICB9CiAgICAvLyAgY291dCA8PCBldmVuIDw8ICIgIiA8PCBvZGQgPDwgZW5kbDsKICAgIHJldHVybiAob2RkICsgZXZlbikgJSBNT0Q7Cn0KCgoKaW50IG1haW4oKQp7CiAgICBsbCBsLCByOwogICAgY2luID4+IGwgPj4gcjsKCiAgICBsbCByZXMgPSAoc29sdmUocikgLSBzb2x2ZShsIC0gMSkpICUgTU9EOwogICAgaWYocmVzIDwgMCkgcmVzICs9IE1PRDsKICAgIGNvdXQgPDwgcmVzIDw8IGVuZGw7CgogICAgcmV0dXJuIDA7Cn0K