#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long l, r;
pair<int, long long> f[70];
int doit(long long u) {
  long long i, j;
  int res = 0;
  for (i = 1, j = 0; i <= u; i <<= 1, j++)
    u -= i, res = (res + f[j].first) % mod;
  res = (res +
         1ll *
             (((f[j].second % mod + f[j].second % mod) + (u % mod * 2) % mod) %
                  mod -
              2 + mod) %
             mod * (u % mod) % mod * (mod / 2 + 1) % mod) %
        mod;
  return res;
}
int main() {
  f[0] = pair<int, long long>(1, 1);
  f[1] = pair<int, long long>(6, 2);
  for (int i = 2; i <= 62; i++) {
    f[i].second = f[i - 2].second + (1ll << (i - 2)) * 2;
    f[i].first = 1ll *
                 ((f[i].second % mod + f[i].second % mod) % mod +
                  (1ll << i) % mod * 2 % mod - 2) %
                 mod * ((1ll << i) % mod) % mod * (mod / 2 + 1) % mod;
  }
  scanf("%I64d%I64d", &l, &r);
  printf("%d\n", (doit(r) - doit(l - 1) + mod) % mod);
}
