#include <bits/stdc++.h>
using namespace std;
template <class T>
bool mini(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool maxi(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
const long long mod = 1e9 + 7;
long long calc(long long r) {
  vector<long long> cur(2, 1), add(2);
  add[0] = -1, add[1] = 0;
  long long n = 0;
  long long sum = 0;
  long long pw = 1;
  while (n < r) {
    long long en = cur[0] + min(pw, r - n) - 1;
    long long dis = en - cur[0] + 1;
    dis %= mod;
    long long a = cur[0] * 2 + add[0], b = en * 2 + add[0];
    a %= mod, b %= mod;
    sum = (sum + (b + a) % mod * dis % mod * 500000004 % mod) % mod;
    cur[0] += pw;
    n += pw;
    pw *= 2;
    swap(cur[0], cur[1]);
    swap(add[0], add[1]);
  }
  return sum;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  long long l, r;
  cin >> l >> r;
  cout << (calc(r) - calc(l - 1) + mod) % mod << "\n";
}
