#include <bits/stdc++.h>
using namespace std;
long long const M = 1e9 + 7;
long long seq(long long start, long long end) {
  long long cnt = (end - start) / 2ll + 1ll;
  long long other = (end + start) / 2ll;
  long long ret = (cnt % M) * (other % M) % M;
  return ret;
}
long long ans(long long n) {
  long long sum = 0;
  long long firstOdd = 1;
  long long firstEven = 2;
  long long step = 1;
  bool oddTurn = true;
  while (n > 0) {
    if (oddTurn) {
      long long nextOdd;
      if (n >= step) {
        nextOdd = firstOdd + step * 2ll;
        n -= step;
      } else {
        nextOdd = firstOdd + n * 2ll;
        n = 0;
      }
      sum = (sum + seq(firstOdd, nextOdd - 2ll)) % M;
      firstOdd = nextOdd;
    } else {
      long long nextEven;
      if (n >= step) {
        nextEven = firstEven + step * 2ll;
        n -= step;
      } else {
        nextEven = firstEven + n * 2ll;
        n = 0;
      }
      sum = (sum + seq(firstEven, nextEven - 2ll)) % M;
      firstEven = nextEven;
    }
    step *= 2ll;
    oddTurn = 1 - oddTurn;
  }
  return sum;
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long l, r;
  cin >> l >> r;
  cout << (ans(r) - ans(l - 1) + M) % M << '\n';
}
