#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long R_2 = (MOD + 1) / 2;
long long cal(long long l, long long r) {
  l %= MOD, r %= MOD;
  return ((l + r) % MOD * ((r - l) * R_2 % MOD + 1) % MOD * R_2 % MOD + MOD) %
         MOD;
}
long long solve(long long n) {
  long long res = 1, a1 = 1, a2 = 1, ans = 0;
  bool flag = true;
  for (long long i = 1; i <= n;) {
    long long r = min(res, n - i + 1);
    if (flag) {
      ans = (ans + cal(a1 * 2 - 1, (a1 + r - 1) * 2 - 1)) % MOD;
      a1 = a1 + res;
    } else {
      ans = (ans + cal(a2 * 2, (a2 + r - 1) * 2)) % MOD;
      a2 = a2 + res;
    }
    flag = !flag;
    i += res;
    res *= 2;
  }
  return ans;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << ((solve(r) - solve(l - 1)) % MOD + MOD) % MOD << endl;
  return 0;
}
