#include <bits/stdc++.h>
using namespace std;
long long l, r;
const long long mod = 1000000007;
long long calc(long long n) {
  long long ans = 0;
  long long sumO = 0, sumE = 0;
  int f = 1;
  long long minn = 0;
  for (long long i = 1; i <= n; i *= 2) {
    long long minn = min(n - ans, i);
    ans += i;
    if (f)
      sumO += minn;
    else
      sumE += minn;
    f = 1 - f;
  }
  sumE %= mod;
  sumO %= mod;
  ans = ((sumO * sumO) + (sumE * sumE + sumE)) % mod;
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  cin >> l >> r;
  cout << (calc(r) - calc(l - 1) + mod) % mod;
  return 0;
}
