#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long getres(long long n) {
  if (n == 0) {
    return 0;
  }
  vector<long long> now;
  for (long long i = 0;; i++) {
    long long t = pow(2, i);
    if (t <= n) {
      n -= t;
      now.push_back(t);
      if (n == 0) {
        break;
      }
    } else {
      now.push_back(n);
      break;
    }
  }
  long long even = 0, odd = 0;
  for (long long i = 0; i < now.size(); i++) {
    if (i % 2) {
      even = (even + now[i]) % mod;
    } else {
      odd = (odd + now[i]) % mod;
    }
  }
  long long odd_sum = (((odd) % mod) * (odd % mod)) % mod;
  long long even_sum = (((even) % mod) * ((even + 1) % mod)) % mod;
  long long res = (odd_sum + even_sum) % mod;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long l, r;
  cin >> l >> r;
  long long ans = (getres(r) - getres(l - 1) + mod) % mod;
  cout << ans << "\n";
}
