#include <bits/stdc++.h>
using namespace std;
long long func(long long n) {
  long long m = 1e9 + 7;
  long long ans = 1, temp = 2;
  while (n >= 1) {
    if (n & 1) {
      ans *= temp;
      ans = ans % m;
    }
    n /= 2;
    temp *= temp;
    temp = temp % m;
  }
  return ans;
}
int main() {
  long long t1 = 0, t2 = 0, n, i, l, r, m = 1e9 + 7, ans1, ans2;
  cin >> l >> r;
  n = log2(l);
  if (n & 1) {
    for (i = 0; i < n; i += 2) {
      t1 += func(i);
      t1 = t1 % m;
    }
    t1 *= t1;
    t1 = t1 % m;
    for (i = 1; i < n; i += 2) {
      t2 += func(i);
      t2 = t2 % m;
    }
    t2 += (l % m - func(i) + m) % m;
    t2 *= t2 + 1;
    t2 = t2 % m;
    ans1 = (t1 + t2) % m;
  } else {
    for (i = 0; i < n; i += 2) {
      t1 += func(i);
      t1 = t1 % m;
    }
    t1 += (l % m - func(i) + m) % m;
    t1 *= t1;
    t1 = t1 % m;
    for (i = 1; i < n; i += 2) {
      t2 += func(i);
      t2 = t2 % m;
    }
    t2 *= t2 + 1;
    t2 = t2 % m;
    ans1 = (t1 + t2) % m;
  }
  n = log2(r + 1);
  t1 = t2 = 0;
  if (n & 1) {
    for (i = 0; i < n; i += 2) {
      t1 += func(i);
      t1 = t1 % m;
    }
    t1 *= t1;
    t1 = t1 % m;
    for (i = 1; i < n; i += 2) {
      t2 += func(i);
      t2 = t2 % m;
    }
    t2 += ((r + 1) % m - func(i) + m) % m;
    t2 *= t2 + 1;
    t2 = t2 % m;
    ans2 = (t1 + t2) % m;
  } else {
    for (i = 0; i < n; i += 2) {
      t1 += func(i);
      t1 = t1 % m;
    }
    t1 += ((r + 1) % m - func(i) + m) % m;
    t1 *= t1;
    t1 = t1 % m;
    for (i = 1; i < n; i += 2) {
      t2 += func(i);
      t2 = t2 % m;
    }
    t2 *= t2 + 1;
    t2 = t2 % m;
    ans2 = (t1 + t2) % m;
  }
  cout << ((ans2 - ans1 + m) % m);
  return 0;
}
