#include <bits/stdc++.h>
const long long N = 500005;
const long long mod = 1e9 + 7;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 1) return (power(a, b - 1) * a) % mod;
  long long q = power(a, b / 2);
  return (q * q) % mod;
}
using namespace std;
long long get(long long n) {
  if (n == 0) return 0;
  long long x = log2(n);
  long long even = 0, odd = 0;
  if (x % 2 == 0) {
    for (int i = 1; i <= x; i += 2) {
      even += power(2, i);
      even %= mod;
    }
    for (int i = 0; i <= x; i += 2) {
      odd += power(2, i);
      odd %= mod;
    }
    odd += n - power(2, x + 1) + 1;
    odd %= mod;
  } else {
    for (int i = 1; i <= x; i += 2) {
      even += power(2, i);
      even %= mod;
    }
    for (int i = 0; i <= x; i += 2) {
      odd += power(2, i);
      odd %= mod;
    }
    even += n - power(2, x + 1) + 1;
    even %= mod;
  }
  return ((((even) * (even + 1)) % mod + (odd * odd) % mod) % mod);
}
void solve() {
  long long r, l;
  cin >> l >> r;
  cout << (get(r) - get(l - 1) + mod) % mod << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
