#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int Pow(long long int x, long long int y) {
  long long int t = y;
  long long int ans = 1;
  while (t) {
    if (t & 1) {
      ans = ans * x;
    }
    x = x * x;
    t >>= 1;
  }
  return ans;
}
int fid(long long int x) {
  int l = 0, r = 60;
  while (r != l) {
    int mid = (l + r) >> 1;
    if (Pow(2, mid + 1) - 1 > x)
      r = mid;
    else
      l++;
  }
  return r - 1;
}
long long int a, b, osl, jsl, osr, jsr;
int main() {
  scanf("%I64d%I64d", &a, &b);
  long long int t1 = fid(a), t2 = fid(b);
  if (t1 % 2 == 0) {
    jsl = (Pow(2, t1 + 2) - 1) / 3;
    if (a == Pow(2, t1 + 1) - 1) jsl--;
    osl = a - jsl - 1;
  } else {
    osl = (Pow(2, t1 + 2) - 2) / 3;
    if (a == Pow(2, t1 + 1) - 1) osl--;
    jsl = a - osl - 1;
  }
  if (t2 % 2 == 0) {
    jsr = (Pow(2, t2 + 2) - 1) / 3;
    osr = b - jsr;
  } else {
    osr = (Pow(2, t2 + 2) - 2) / 3;
    jsr = b - osr;
  }
  long long int ret1, ret2;
  if (osr > osl)
    ret1 =
        (((((((osl + 1ULL) % mod) * 2ULL + (osr % mod) * 2ULL) % mod) % mod) *
          ((osr - osl) % mod) % mod) *
         500000004) %
        mod;
  else
    ret1 = 0;
  if (jsr > jsl)
    ret2 =
        ((((((jsl * 2ULL + 1ULL) % mod) + ((jsr * 2ULL - 1ULL) % mod)) % mod) *
          ((jsr - jsl) % mod) % mod) *
         500000004) %
        mod;
  else
    ret2 = 0;
  printf("%I64d", (ret1 + ret2) % mod);
}
