#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  long long res = 1;
  long long n = 0;
  while (res <= l) {
    res *= 2LL;
    n++;
  }
  res = 1;
  long long m = 0;
  while (res <= r) {
    res *= 2LL;
    m++;
  }
  long long odd = n / 2LL, even = (n - 1) / 2LL;
  long long sum1 = 0, sum2 = 0;
  long long st, now;
  res = 1;
  for (long long i = 1; i <= odd; i++) {
    sum1 += res;
    res *= 4LL;
  }
  res = 2;
  for (long long i = 1; i <= even; i++) {
    sum2 += res;
    res *= 4LL;
  }
  if (n % 2) {
    now = (long long)1 << (n - 1);
    sum1 = l - now + sum1 + 1;
    st = sum1 * 2 - 1;
    sum1 = ((sum1 % mod) * (sum1 % mod)) % mod;
    sum2 = ((sum2 % mod) * ((sum2 + 1LL) % mod)) % mod;
  } else {
    now = (long long)1 << (n - 1);
    sum2 = l - now + sum2 + 1;
    st = sum2 * 2;
    sum1 = ((sum1 % mod) * (sum1 % mod)) % mod;
    sum2 = ((sum2 % mod) * ((sum2 + 1LL) % mod)) % mod;
  }
  res = 1;
  odd = m / 2, even = (m - 1) / 2;
  long long sum3 = sum1, sum4 = sum2;
  sum1 = sum2 = 0;
  for (long long i = 1; i <= odd; i++) {
    sum1 += res;
    res *= 4LL;
  }
  res = 2;
  for (long long i = 1; i <= even; i++) {
    sum2 += res;
    res *= 4LL;
  }
  if (m % 2) {
    now = (long long)1 << (m - 1);
    sum1 = r - now + sum1 + 1;
    sum1 = ((sum1 % mod) * (sum1 % mod)) % mod;
    sum2 = ((sum2 % mod) * ((sum2 + 1LL) % mod)) % mod;
  } else {
    now = (long long)1 << (m - 1);
    sum2 = r - now + sum2 + 1;
    sum1 = ((sum1 % mod) * (sum1 % mod)) % mod;
    sum2 = ((sum2 % mod) * ((sum2 + 1LL) % mod)) % mod;
  }
  cout << (mod + (sum1 + sum2) % mod - (sum3 + sum4) % mod + st) % mod << endl;
  return 0;
}
