#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
const long long INF = 1e9 + 7;
long long n, m, ans, l, r;
long long segment, average, number, start;
struct node {
  long long ai, bi;
};
node p[maxn];
long long cmp(node x, node y) { return ((x.ai - x.bi) < (y.ai - y.bi)); }
void Init() {}
long long GetSum(long long N) {
  long long res = 0, nn = N, tmp;
  average = 1;
  number = 1;
  segment = 1;
  start = 1;
  while (nn > number) {
    tmp = (average % INF) * (number % INF);
    res = (res + tmp) % INF;
    nn -= number;
    start = (start + start) % INF;
    average = (average + average) % INF;
    if (segment % 2) average++;
    if (segment % 2 == 0) start--;
    segment++;
    number = number + number;
  }
  tmp = ((start + nn - 1) % INF) * (nn % INF);
  res = res + tmp % INF;
  res %= INF;
  return res;
}
void solution() {
  ans = GetSum(r);
  ans = ans - GetSum(l - 1);
  if (ans < 0) ans += INF;
  cout << ans << endl;
}
int main() {
  while (cin >> l >> r) {
    Init();
    solution();
  }
  return 0;
}
