#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007l;
long long go(long long n) {
  long long evenIndx = 0, oddIndx = 0;
  for (int i = 0; i < 64 && n; i++) {
    long long sub = min((1ll << (long long)i), n);
    if (i % 2 == 0)
      oddIndx += sub;
    else
      evenIndx += sub;
    n -= sub;
  }
  oddIndx %= mod;
  oddIndx = oddIndx * oddIndx;
  oddIndx %= mod;
  evenIndx %= mod;
  evenIndx = (evenIndx * evenIndx) % mod + evenIndx;
  evenIndx %= mod;
  return (oddIndx + evenIndx) % mod;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << (go(r) - go(l - 1) + mod) % mod;
}
