#include <bits/stdc++.h>
using namespace std;
template <typename T>
void qmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void qmin(const T &a, T b) {
  a = min(a, b);
}
const long long mod = 1e9 + 7;
long long solve(long long x) {
  long long cnt[2] = {0, 0};
  int k = 0;
  long long c = 1;
  while (x) {
    cnt[k] += min(c, x);
    x -= min(c, x);
    k ^= 1;
    c <<= 1;
  }
  long long sum = (cnt[0] % mod) * (cnt[0] % mod) % mod;
  sum += (cnt[1] % mod) * ((cnt[1] + 1) % mod) % mod;
  return sum % mod;
}
int main() {
  ios::sync_with_stdio(false);
  long long l, r;
  cin >> l >> r;
  cout << ((solve(r) - solve(l - 1) + mod) % mod) << endl;
  return 0;
}
