#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 11;
const long long mod = 1e9 + 7;
long long l, r, now = 1, sta, A, B;
long long odd, even;
long long get(long long g) {
  A = B = now = sta = 0;
  now = sta = 1;
  odd = even = 0;
  long long ans = 0;
  while (1) {
    if (sta)
      ans += (now / 2) % mod * ((B + now / 2) % mod) % mod;
    else
      ans += (now / 2) % mod * ((A + now / 2) % mod) % mod;
    if (sta)
      B += now;
    else
      A += now;
    if (now > g) break;
    now *= 2;
    sta ^= 1;
  }
  now--;
  sta ^= 1;
  if (sta)
    ans -= (now - g) % mod * ((A - (now - g) + mod) % mod) % mod;
  else
    ans -= (now - g) % mod * ((B - (now - g) + mod) % mod) % mod;
  return (ans + mod) % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> l >> r;
  cout << (get(r) - get(l - 1) + mod) % mod << endl;
  return 0;
}
