#include <bits/stdc++.h>
using namespace std;
long long l, r;
int solve(long long n) {
  long long x = 0, y = 0;
  int i = 1;
  long long pow = 1;
  while (x + y < n) {
    if (i) {
      x += min(pow, n - x - y);
    } else {
      y += min(pow, n - x - y);
    }
    pow *= 2;
    i ^= 1;
  }
  x %= 1000000007;
  y %= 1000000007;
  return (1LL * x * x % 1000000007 + 1LL * y * (y + 1) % 1000000007) %
         1000000007;
}
int main() {
  cin >> l >> r;
  cout << (1LL * 1000000007 + 1LL * solve(r) - 1LL * solve(l - 1)) % 1000000007;
  return 0;
}
