#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
using namespace std;
inline int in() {
  int x = 0, w = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') w = 0, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return w ? x : -x;
}
unsigned long long l, r;
unsigned long long P = 1000000007LL;
unsigned long long cont(unsigned long long n) {
  if (n <= 1LL) return n;
  unsigned long long d = 1LL, b = 0LL, sum[3], c = 1LL;
  sum[1] = 0LL;
  sum[0] = 0LL;
  while (n >= d && d != 0) {
    b = (c & 1LL);
    sum[b] += d;
    n -= d;
    c++;
    d *= 2LL;
    if (d > n) d = n;
  }
  unsigned long long u1 = ((sum[1] % P) * (sum[1] % P)) % P;
  unsigned long long u2 = (((sum[0] + 1) % P) * (sum[0] % P)) % P;
  return (u1 + u2) % P;
}
int main() {
  std::ios::sync_with_stdio(false);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin >> l >> r;
  unsigned long long L = cont(l - 1LL) % P;
  unsigned long long R = cont(r) % P;
  cout << (R - L + P * 1LL) % P << endl;
}
