#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, inv = 5e8 + 4;
int sum(long long x, long long n, int r) {
  x %= mod;
  n %= mod;
  return n * (2 * x + r * (n - 1) % mod) % mod * inv % mod;
}
int solve(long long i) {
  long long x[2] = {0, 0}, p = 1;
  int k;
  for (k = 1; x[0] + x[1] < i; k ^= 1, p <<= 1) x[k] += p;
  x[k ^ 1] -= x[0] + x[1] - i;
  return (sum(2, x[0], 2) + sum(1, x[1], 2)) % mod;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long l, r;
  cin >> l >> r;
  int ans = solve(r) - solve(l - 1);
  cout << (ans + mod) % mod << '\n';
  return 0;
}
