#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, i, e, f, g, n, m, k, l, r;
long long go(long long x) {
  k = 1;
  n = 0;
  m = 0;
  for (long long i = 1;; i++) {
    if (x <= 0)
      return ((m * (m + 1)) % 1000000007 + (n * n) % 1000000007) % 1000000007;
    if (i % 2 == 1) {
      n += min(k, x);
      n %= 1000000007;
      x -= k;
    } else {
      m += min(k, x);
      m %= 1000000007;
      x -= k;
    }
    k *= 2;
  }
}
int main() {
  cin >> l >> r;
  cout << (1000000007 + go(r) - go(l - 1)) % 1000000007;
}
