#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long f(long long x) {
  long long odd = 0;
  long long even = 0;
  long long idx = 1;
  int turn = 0;
  while (1) {
    if (turn % 2) {
      even += idx;
      if (even + odd > x) {
        even -= even + odd - x;
        break;
      }
    } else {
      odd += idx;
      if (even + odd > x) {
        odd -= even + odd - x;
        break;
      }
    }
    idx *= 2LL;
    turn++;
  }
  even %= mod;
  odd %= mod;
  return (even * (even + 1) + odd * odd) % mod;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long l, r;
  cin >> l >> r;
  long long ans = f(r) - f(l - 1);
  ans += mod;
  ans %= mod;
  cout << ans;
  return 0;
}
