#include <bits/stdc++.h>
using namespace std;
long long int em(long long int x, long long int Mod, long long int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return em((x % Mod * x % Mod) % Mod, Mod, n / 2) % Mod;
  else
    return (x % Mod * em((x % Mod * x % Mod) % Mod, Mod, (n - 1) / 2)) % Mod;
}
vector<long long int> posi;
long long int fun(long long int x) {
  long long int no = 0, ne = 0, u, i;
  long long int n1, n2;
  auto itr = lower_bound(posi.begin(), posi.end(), x);
  if (*itr != x) itr--;
  u = x - *itr;
  long long int ind = itr - posi.begin();
  if ((ind % 2) == 0) {
    no += u;
    n1 = ind / 2;
    n2 = ind / 2;
  } else {
    ne += u;
    n1 = (ind + 1) / 2;
    n2 = ind / 2;
  }
  for (i = 0; i < n1; i++)
    no = (no % 1000000007 + (1ll << (2ll * i))) % 1000000007;
  for (i = 0; i < n2; i++)
    ne = (ne % 1000000007 + (1ll << (2ll * i + 1ll)) % 1000000007) % 1000000007;
  long long int sumo = 0, sume = 0;
  sumo = (no % 1000000007 * no % 1000000007) % 1000000007;
  sume = ((ne % 1000000007) * (ne + 1ll) % 1000000007) % 1000000007;
  return (sumo + sume) % 1000000007;
}
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int l, r, i, j, k;
  cin >> l >> r;
  posi.push_back(0);
  for (long long int i = (long long int)0; i < (long long int)62; i++) {
    long long int u = posi.back();
    u += 1ll << i;
    posi.push_back(u);
  }
  cout << (fun(r) % 1000000007 - fun(l - 1) % 1000000007 + 1000000007) %
              1000000007;
}
