#include <bits/stdc++.h>
using namespace std;
const int64_t BASE = 1e9 + 7;
int64_t Left, Right;
int64_t Calc(int64_t x) {
  int64_t powTwo = 1, numEven = 0, numOdd = 0;
  for (int i = 0; x > 0; ++i) {
    if (i) powTwo *= 2;
    if (i % 2 == 0)
      numOdd = (numOdd + min(x, powTwo)) % BASE;
    else
      numEven = (numEven + min(x, powTwo)) % BASE;
    x -= min(x, powTwo);
  }
  return ((numOdd * numOdd) % BASE + (numEven * (numEven + 1) % BASE) % BASE) %
         BASE;
}
int main() {
  cin >> Left >> Right;
  cout << (Calc(Right) - Calc(Left - 1) + BASE) % BASE;
  return 0;
}
