#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long f(long long x) {
  long long b = 1, o = 1, e = 2, ret = 0;
  bool flag = true;
  while (x) {
    long long l = min(x, b);
    x -= l;
    if (flag) {
      long long oo = o + 2 * l;
      long long d = (o + oo - 2) / 2 % mod * (l % mod) % mod;
      ret = (ret + d) % mod;
      o = oo;
    } else {
      long long ee = e + 2 * l;
      long long d = (e + ee - 2) / 2 % mod * (l % mod) % mod;
      ret = (ret + d) % mod;
      e = ee;
    }
    flag = !flag;
    b <<= 1;
  }
  return ret;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << (mod + f(r) - f(l - 1)) % mod;
  return 0;
}
