#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long isPowerof2(long long x) { return (x && !(x & x - 1)); }
long long mod = 1e9 + 7;
long long p[64];
void fill() {
  p[0] = 1;
  for (long long(i) = (1); i < (64); i++) {
    p[i] = 2 * p[i - 1];
    p[i] %= mod;
  }
}
long long first(long long x) {
  if (x == 0) return 0;
  long long cnt = floor((double)(log2(x)));
  long long ocb4 = 0, ecb4 = 0;
  for (long long(i) = (0); i < (cnt); i++) {
    if (i & 1) {
      ecb4 += p[i];
      ecb4 %= mod;
    } else {
      ocb4 += p[i];
      ocb4 %= mod;
    }
  }
  if (cnt & 1) {
    long long e, o;
    e = (x - (((long long)(pow(2, cnt))) % mod) + 1 + ecb4 + mod) % mod;
    o = ocb4;
    long long sum = ((e * e) % mod + e + (o * o) % mod) % mod;
    return sum;
  } else {
    long long e, o;
    e = ecb4;
    o = (x - (((long long)(pow(2, cnt))) % mod) + 1 + ocb4 + mod) % mod;
    long long sum = ((e * e) % mod + e + (o * o) % mod) % mod;
    return sum;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ostream_iterator<long long> output(cout, " ");
  fill();
  long long l, r;
  cin >> l >> r;
  cout << (first(r) - first(l - 1) + mod) % mod;
  return 0;
}
