#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long int sum(long long int x) {
  long long int odd = 0, even = 0;
  for (long long int i = 0;; i++) {
    if (x <= 0) break;
    long long int dd = 1ll << i;
    dd = min(x, dd);
    x -= dd;
    if (i % 2 == 0) {
      odd += dd;
    } else {
      even += dd;
    }
  }
  even %= mod;
  odd %= mod;
  return (even * (even + 1) % mod + odd * odd % mod) % mod;
}
int main() {
  long long int l, r;
  cin >> l >> r;
  long long int ans = (sum(r) - sum(l - 1) + mod) % mod;
  cout << ans << endl;
  return 0;
}
