#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
inline long long ad(long long x, long long y) {
  return (x >= mod - y) ? (x - mod + y) : x + y;
}
inline long long re(long long x, long long y) {
  return (x < y) ? (x - y + mod) : x - y;
}
long long solve(long long n) {
  if (n == 0) return 0;
  int op = 1;
  long long i, step = 0, ost = 1, est = 2, ret = 0;
  for (i = 1; i <= n; i <<= 1) {
    if (step + i >= n) break;
    if (op == 1) {
      long long ed = ost + 2 * (i - 1);
      ret = ad(ret, (ost + ed) % mod * (i % mod) % mod * (mod / 2 + 1) % mod);
      ost = ed + 2;
    } else {
      long long ed = est + 2 * (i - 1);
      ret = ad(ret, (est + ed) % mod * (i % mod) % mod * (mod / 2 + 1) % mod);
      est = ed + 2;
    }
    op ^= 1;
    step += i;
  }
  if (op == 1) {
    long long ed = ost + 2 * (n - step - 1);
    if (ed % 2 == 0) ed--;
    ret = ad(ret,
             (ost + ed) % mod * ((n - step) % mod) % mod * (mod / 2 + 1) % mod);
  } else {
    long long ed = est + 2 * (n - step - 1);
    if (ed % 2 == 1) ed--;
    ret = ad(ret,
             (est + ed) % mod * ((n - step) % mod) % mod * (mod / 2 + 1) % mod);
  }
  return ret;
}
int main() {
  long long l, r;
  scanf("%lld %lld", &l, &r);
  printf("%lld\n", re(solve(r), solve(l - 1)));
  return 0;
}
