#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize "-O3"
long long INF = (long long)1e20;
int iINF = (int)1e20;
long long mod = 1e9 + 7;
long long mult(long long a, long long b) {
  if (a == 0) return 0;
  if (a == 1) return (b % mod);
  if (a % 2) {
    long long kek = mult(a / 2, b) % mod;
    kek *= 2;
    kek %= mod;
    kek += b;
    kek %= mod;
    return kek;
  } else {
    long long kek = mult(a / 2, b) % mod;
    kek *= 2;
    kek %= mod;
    return kek;
  }
}
long long f(long long r) {
  long long odd = 0, even = 0;
  long long now = 1;
  bool chet = false;
  while (r > 0) {
    long long num = min(r, now);
    if (chet)
      even += num;
    else
      odd += num;
    r -= now;
    now *= 2;
    chet = !chet;
  }
  return (mult(odd, odd) + mult(even, even) + even) % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long l, r;
  cin >> l >> r;
  cout << (f(r) - f(l - 1) + mod) % mod;
}
