#include <bits/stdc++.h>
#pragma comment(linker, "/stack:256000000")
using namespace std;
mt19937_64 gen(time(NULL));
long long const maxn = 3e5 + 5;
long long const mod = 1e9 + 7;
long long f(long long x) {
  long long kek = 1;
  long long st = 1;
  vector<long long> cnt(2, 0);
  while (x >= st) {
    x -= st;
    cnt[kek] += st;
    kek ^= 1;
    st *= 2;
  }
  cnt[kek] += x;
  long long ans = 0;
  ans += (cnt[0] % mod) * ((cnt[0] + 1) % mod);
  ans %= mod;
  ans += (cnt[1] % mod) * (cnt[1] % mod);
  ans %= mod;
  if (ans < 0) ans += mod;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long l, r;
  cin >> l >> r;
  long long kek = f(r) - (l > 1 ? f(l - 1) : 0);
  kek = (kek + mod) % mod;
  cout << kek << endl;
  return 0;
}
