#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long l, r;
long long slove(long long x) {
  long long p = 1, odd = 0, even = 0, flag = 1;
  while (p <= x) {
    x -= p;
    if (flag)
      odd = (odd + p) % mod;
    else
      even = (even + p) % mod;
    p *= 2;
    flag ^= 1;
  }
  if (flag)
    odd = (odd + x) % mod;
  else
    even = (even + x) % mod;
  return (odd % mod * odd % mod + (even + 1) % mod * even % mod) % mod;
}
int main() {
  cin >> l >> r;
  cout << (slove(r) - slove(l - 1) + mod) % mod << endl;
  return 0;
}
