#include <bits/stdc++.h>
using namespace std;
const unsigned long long inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-9;
const int mod = 1e9 + 7;
unsigned long long l, r;
unsigned long long solve(unsigned long long n) {
  if (n == 0) return 0;
  unsigned long long jn = 0, on = 0;
  unsigned long long i, fg = 0;
  for (i = 1; i <= n; i *= 2) {
    if (!fg)
      jn += i, fg ^= 1, n -= i;
    else
      on += i, fg ^= 1, n -= i;
  }
  if (n) {
    if (!fg)
      jn += n;
    else
      on += n;
  }
  unsigned long long sum = (((1 + on) % mod) * (on % mod)) % mod;
  sum += ((jn % mod) * (jn % mod)) % mod;
  return sum % mod;
}
int main() {
  std::ios::sync_with_stdio(0);
  cin >> l >> r;
  cout << (solve(r) - solve(l - 1) + mod) % mod << endl;
  return 0;
}
