#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  long long l, r;
  cin >> l >> r;
  l--;
  long long llen = -1, rlen = -1;
  long long ll = l, rr = r;
  while (ll) {
    llen++;
    ll /= 2;
  }
  while (rr) {
    rlen++;
    rr /= 2;
  }
  long long lji = llen / 2 + llen % 2, rji = rlen / 2 + rlen % 2,
            lou = llen / 2, rou = rlen / 2;
  long long ljishuxiang = (1 - (long long)pow(4, lji)) / (1 - 4);
  long long loushuxiang = (2 - 2 * (long long)pow(4, lou)) / (1 - 4);
  long long rjishuxiang = (1 - (long long)pow(4, rji)) / (1 - 4);
  long long roushuxiang = (2 - 2 * (long long)pow(4, rou)) / (1 - 4);
  if (llen % 2 == 1) {
    loushuxiang += (l - (long long)pow(2, llen) + 1);
  }
  if (llen % 2 == 0) {
    ljishuxiang += (l - (long long)pow(2, llen) + 1);
  }
  if (rlen % 2 == 1) {
    roushuxiang += (r - (long long)pow(2, rlen) + 1);
  }
  if (rlen % 2 == 0) {
    rjishuxiang += (r - (long long)pow(2, rlen) + 1);
  }
  long long lsum =
      ((ljishuxiang % mod) * (ljishuxiang % mod) % mod +
       (loushuxiang % mod) * (loushuxiang % mod) % mod + loushuxiang % mod) %
      mod;
  long long rsum =
      ((rjishuxiang % mod) * (rjishuxiang % mod) % mod +
       (roushuxiang % mod) * (roushuxiang % mod) % mod + roushuxiang % mod) %
      mod;
  cout << (rsum + mod - lsum) % mod << endl;
  return 0;
}
