#include <bits/stdc++.h>
using namespace std;
long long sumImp(long long n) {
  long long res = (n + 1) % 1000000007LL +
                  (n % 1000000007LL * ((n + 1) % 1000000007LL)) % 1000000007LL;
  res %= 1000000007LL;
  return res;
}
long long sumPar(long long n) {
  long long res = (n % 1000000007LL * ((n + 1) % 1000000007LL)) % 1000000007LL;
  return res;
}
long long bb(long long pos) {
  long long i = -1LL;
  long long sum = 1LL;
  long long ac = 2LL;
  while (sum <= pos) {
    i++;
    sum += ac;
    ac *= 2;
  }
  return i;
}
long long sum4(long long k) {
  long long res = 1LL;
  for (long long i = 1; i <= k + 1; i++) res *= 4LL;
  res -= 1LL;
  res /= 3LL;
  return res;
}
long long acc(long long pos) {
  if (pos == 0LL) return 0LL;
  long long i = bb(pos);
  long long ni, np;
  long long ki;
  ki = i / 2LL;
  ni = sum4(ki);
  ki = (i + 1LL) / 2LL - 1LL;
  np = 2LL * sum4(ki);
  long long ex = pos - ni - np;
  if (i % 2LL == 0)
    np += ex;
  else
    ni += ex;
  return (sumPar(np) + sumImp(ni - 1)) % 1000000007LL;
}
int main() {
  long long l, r;
  scanf("%lld %lld", &l, &r);
  long long res = acc(r) % 1000000007LL - acc(l - 1) % 1000000007LL;
  while (res < 0LL) res += 1000000007LL;
  printf("%lld\n", res % 1000000007LL);
  return 0;
}
