#include <bits/stdc++.h>
using namespace std;
const long double PI = 2 * acos(0.0);
long long mul(long long n, long long p) {
  if (p == 1) return n;
  long long d = mul(n, p / 2);
  d = (d + d) % 1000000007;
  if (p & 1) d = (d + n) % 1000000007;
  return d;
}
long long solve(long long n) {
  if (n == 0) return 0;
  long long k = log2(n + 1), p = 1, odd = 0, even = 0;
  for (long long i = 0; i < k; i++) {
    if (i & 1) {
      even += p;
    } else
      odd += p;
    p *= 2;
  }
  if (k & 1)
    even += (n - p + 1);
  else
    odd += (n - p + 1);
  long long ans = (mul(even, even + 1)) % 1000000007;
  ans = (ans + (mul(odd, odd)) % 1000000007) % 1000000007;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long l, r;
  cin >> l >> r;
  cout << (solve(r) - solve(l - 1) + 1000000007) % 1000000007;
  return 0;
}
