#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
const long long maxn = (long long)1e5 + 5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max() - 1;
const long long INF = 1e18;
long long dx[] = {0, 1, 0, -1};
long long dy[] = {1, 0, -1, 0};
long long dxx[] = {0, 1, 0, -1, 1, 1, -1, -1};
long long dyy[] = {1, 0, -1, 0, 1, -1, 1, -1};
long long sq(long long a) {
  a %= mod;
  return (a * a) % mod;
}
long long odd(long long l, long long r) {
  return (sq(r) - sq(l - 1) + mod) % mod;
}
long long even(long long l, long long r) {
  return (odd(l, r) + (r - l + 1)) % mod;
}
long long find(long long n) {
  long long sum = 0;
  long long a = 1, b = 1;
  long long pos = 1;
  long long tot = 0;
  long long sz = 1;
  while (1) {
    if (tot + sz > n) {
      if (pos) {
        sum = (sum + odd(a, a + n - tot)) % mod;
      } else
        sum = (sum + even(b, b + n - tot)) % mod;
      return sum;
    }
    tot += sz;
    if (pos) {
      sum = (sum + odd(a, a + sz - 1)) % mod;
      a += sz;
    } else {
      sum = (sum + even(b, b + sz - 1)) % mod;
      b += sz;
    }
    pos ^= 1;
    sz *= 2;
  }
  return sum;
}
void solve() {
  long long l, r;
  cin >> l >> r;
  cout << (find(r - 1) - find(l - 2) + mod) % mod;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
