#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long solve(long long x) {
  long long s = 1;
  int k = 1;
  long long sum = 1;
  long long ans1 = 1;
  long long ans2 = 0;
  while (sum < x) {
    s *= 2;
    sum += s;
    k = -k;
    if (k == 1)
      ans1 += s;
    else
      ans2 += s;
  }
  if (k == 1) {
    ans1 -= s;
    sum -= s;
    ans1 += x - sum;
  } else {
    ans2 -= s;
    sum -= s;
    ans2 += x - sum;
  }
  long long S = (ans1 % mod) * (ans1 % mod) % mod;
  S += (ans2 % mod) * ((ans2 + 1) % mod) % mod;
  return S % mod;
}
int main() {
  long long l, r;
  scanf("%lld%lld", &l, &r);
  cout << (solve(r) % mod - solve(l - 1) % mod + mod) % mod;
  return 0;
}
