#include <bits/stdc++.h>
using namespace std;
long long mod(long long a, long long m = 1000000007) {
  if (a < 0) a += m;
  a %= m;
  if (a < 0) a += m;
  return a;
}
long long func(long long x) {
  if (x <= 1) return x;
  long long ans = 0;
  long long arr[2] = {1, 2};
  long long size = 1;
  int turn = 0;
  long long temp;
  while (x) {
    if (x >= size) {
      temp = ((mod(size)) * (mod(arr[turn] + (size - 1))));
      arr[turn] = mod(arr[turn] + (size)*2ll);
      turn ^= 1;
      x -= size;
    } else {
      size = x;
      temp = ((mod(size)) * (mod(arr[turn] + (size - 1))));
      arr[turn] = mod(arr[turn] + (size)*2ll);
      turn ^= 1;
      x = 0;
    }
    ans = mod(ans + temp);
    size = size * 2ll;
  }
  return mod(ans);
}
int main() {
  long long i, j, k, l, n, test_case, m, r;
  test_case = 1;
  while (test_case--) {
    cin >> l >> r;
    cout << mod(func(r) - func(l - 1));
  }
  return 0;
}
