#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long l, r, odd, even, fodd, feven, hp = 0, hp2 = 1;
bool flag;
long long cnt(long long a, long long b) {
  a %= MOD;
  long long ans = (a * (b % MOD)) % MOD;
  b %= MOD;
  ans += (b * (b - 1)) % MOD;
  ans %= MOD;
  return ans;
}
int main() {
  cin >> l >> r;
  while (hp * 2 + 1 < l) {
    hp *= 2;
    hp += 1;
    if (flag) {
      even += hp2;
    } else {
      odd += hp2;
    }
    hp2 *= 2;
    flag = !flag;
  }
  if (flag)
    even += l - hp - 1;
  else
    odd += l - hp - 1;
  feven = 2 + (even)*2;
  fodd = 1 + (odd)*2;
  odd = 0;
  even = 0;
  r++;
  if (hp * 2 + 1 < r) {
    long long smt = (l - hp - 1);
    hp *= 2;
    hp += 1;
    if (flag)
      even += hp2 - smt;
    else
      odd += hp2 - smt;
    flag = !flag;
    hp2 *= 2;
    while (hp * 2 + 1 < r) {
      hp *= 2;
      hp += 1;
      if (flag) {
        even += hp2;
      } else {
        odd += hp2;
      }
      hp2 *= 2;
      flag = !flag;
    }
    if (flag)
      even += r - hp - 1;
    else
      odd += r - hp - 1;
  } else {
    if (flag)
      even = r - l;
    else
      odd = r - l;
  }
  cout << (cnt(feven, even) + cnt(fodd, odd)) % MOD;
}
