#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long from[100];
long long first[100];
long long len[100];
long long solve(long long limit) {
  long long result = 0;
  for (int i = 0; from[i] < limit; i++) {
    long long cur_len = min(limit - from[i], len[i]);
    result += (first[i] + cur_len - 1) % mod * (cur_len % mod);
    result %= mod;
  }
  return result;
}
int main() {
  vector<long long> cur{3, 2};
  from[0] = 0;
  len[0] = 1;
  first[0] = 1;
  long long d;
  int i;
  for (i = 1, d = 2;; d *= 2, i++) {
    from[i] = from[i - 1] + d / 2;
    len[i] = d;
    first[i] = cur[i % 2];
    cur[i % 2] += d * 2;
    if (cur[i % 2] > 4.1e18) break;
  }
  long long l, r;
  cin >> l >> r;
  cout << (mod + solve(r) - solve(l - 1)) % mod << endl;
  return 0;
}
