#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 5;
const long long maxx = (long long)10000001;
const int maxm = (int)2e3 + 5;
const int INF = 0x3f3f3f3f;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int MOD = (int)1e9 + 7;
template <class T>
inline void read(T &x) {
  x = 0;
  T flag = 1;
  char c;
  do {
    c = (char)getchar();
    if (c == '-') break;
  } while (c < '0' || c > '9');
  if (c == '-') {
    c = '0', flag = -1;
  }
  do {
    x = x * 10 + c - '0';
    c = (char)getchar();
  } while (c >= '0' && c <= '9');
  x *= flag;
}
template <class T>
inline void out(T x) {
  if (x > 9) out(x / 10);
  x = x % 10;
  putchar('0' + x);
}
int main() {
  long long l, r;
  read(l);
  --l;
  read(r);
  long long len[2] = {0, 0}, sum = 0, cur = 1;
  int turn = 0;
  while (sum < l) {
    if (sum + cur > l) {
      len[turn] += l - sum;
      break;
    }
    len[turn] += cur;
    sum += cur;
    cur <<= 1;
    turn = 1 - turn;
  }
  long long sum1 = len[0] % MOD * (len[0] % MOD) % MOD;
  sum1 = (sum1 + len[1] % MOD * ((len[1] + 1) % MOD) % MOD) % MOD;
  len[0] = 0, len[1] = 0, sum = 0, cur = 1;
  turn = 0;
  while (sum < r) {
    if (sum + cur > r) {
      len[turn] += r - sum;
      break;
    }
    len[turn] += cur;
    sum += cur;
    cur <<= 1;
    turn = 1 - turn;
  }
  long long sum2 = len[0] % MOD * (len[0] % MOD) % MOD;
  sum2 = (sum2 + len[1] % MOD * ((len[1] + 1) % MOD) % MOD) % MOD;
  printf("%lld\n", (sum2 - sum1 + MOD) % MOD);
  return 0;
}
