#include <bits/stdc++.h>
using namespace std;
const long long M = 1000 * 1000 * 1000 + 7;
long long l, r;
long long sum(long long a, long long n) {
  return (a + n - 1) % M * (n % M) % M;
}
long long deal(long long n) {
  vector<long long> c(2, 0);
  for (int i = 0; i < 63; i++) {
    if ((1ll << i) <= n) {
      c[i & 1 ^ 1] += 1ll << i;
      n -= (1ll << i);
    } else {
      c[i & 1 ^ 1] += n;
      break;
    }
  }
  return (sum(1, c[1]) + sum(2, c[0])) % M;
}
int main() {
  while (cin >> l >> r) {
    long long sl = deal(l - 1);
    long long sr = deal(r);
    cout << (sr + M - sl) % M << endl;
  }
  return 0;
}
