#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 2, MOD = 1e9 + 7;
long long evenKoyta(long long x) {
  long long upto = 1;
  long long ase = 0;
  long long jump = 1;
  bool toAdd = true;
  while (upto < x) {
    upto += (jump * 2);
    if (toAdd) ase += (jump * 2);
    jump *= 2;
    toAdd = !toAdd;
  }
  if (upto == x) return ase;
  long long ret;
  if (toAdd == false)
    ret = ase - (upto - x);
  else
    ret = ase;
  return ret;
}
long long oddKoyta(long long x) {
  long long upto = 1;
  long long ase = 1;
  long long jump = 2;
  bool toAdd = false;
  while (upto < x) {
    upto += jump;
    if (toAdd) ase += jump;
    jump *= 2;
    toAdd = !toAdd;
  }
  if (upto == x) return ase;
  long long ret;
  if (toAdd == false)
    ret = ase - (upto - x);
  else
    ret = ase;
  return ret;
}
inline long long sum(long long x) {
  if (x <= 0) return 0;
  long long ret = 0;
  long long n = oddKoyta(x) % MOD;
  ret = (ret + ((n % MOD) * (n % MOD)) % MOD) % MOD;
  n = evenKoyta(x) % MOD;
  ret = (ret + ((n % MOD) * ((n + 1) % MOD)) % MOD) % MOD;
  return ret;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << (sum(r) - sum(l - 1) + MOD) % MOD << endl;
  return 0;
}
