#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long qpow(long long a, long long n) {
  long long y = a, res = 1;
  while (n) {
    if (n & 1) res = (res * y) % mod;
    y = (y * y) % mod;
    n >>= 1;
  }
  return res;
}
long long findt(long long n) {
  long long s = 1, t = 0;
  ;
  while (n >= 2 * s) {
    s *= 2;
    t++;
  }
  return t;
}
long long sum(long long n) {
  return (n * (n + 1) / 2) % mod;
  ;
}
long long s[100], xx[100], yy[100];
long long f(long long n) {
  long long ans = 0;
  long long p = 0, q = 1;
  if (n == 0) return 0;
  if (n == 1) return 1;
  if (n == 2) return 3;
  if (n == 3) return 7;
  while (n >= 2 * q) {
    ans = (ans + s[p]) % mod;
    q *= 2;
    p++;
  }
  if (p % 2) {
    long long y = yy[p], y0 = y / 2;
    ans = (ans - y0 % mod * ((y0 + 1) % mod) % mod + mod) % mod;
    y += 2 * (n - q + 1);
    y0 = y / 2;
    ans = (ans + y0 % mod * ((y0 + 1) % mod) % mod) % mod;
  } else {
    long long x = xx[p], x0 = (x - 1) / 2;
    ans = (ans - (x0 + 1) % mod * ((x0 + 1) % mod) % mod + mod) % mod;
    x += 2 * (n - q + 1);
    x0 = (x - 1) / 2;
    ans = (ans + (x0 + 1) % mod * ((x0 + 1) % mod) % mod + mod) % mod;
  }
  return ans;
}
long long a[1000000];
long long test(long long n) {
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    sum = (sum + a[i]) % mod;
  }
  return sum;
}
int main() {
  long long x = 1, y = 4;
  long long q = 1;
  s[0] = 1, s[1] = 6;
  xx[0] = 1, yy[1] = 4;
  for (long long i = 2, j = 8; j < 2e18 + 1; i++, j *= 2) {
    if (q) {
      long long n = (x + j - 1) / 2, x0 = (x - 1) / 2;
      s[i] = ((n + 1) % mod * ((n + 1) % mod) % mod -
              ((x0 + 1) % mod) * ((x0 + 1) % mod) % mod + mod) %
             mod;
      xx[i] = x;
      x = 2 * n + 1;
      q ^= 1;
    } else {
      long long n = (y + j) / 2, y0 = (y) / 2;
      s[i] = (n % mod * ((n + 1) % mod) % mod -
              y0 % mod * ((y0 + 1) % mod) % mod + mod) %
             mod;
      yy[i] = y;
      y = 2 * n;
      q ^= 1;
    }
  }
  long long l, r;
  cin >> l >> r;
  cout << (f(r) - f(l - 1) + mod) % mod << endl;
  return 0;
}
