#include <bits/stdc++.h>
using namespace std;
long long getSum(long long x) {
  long long co, ce;
  co = ce = 0;
  for (long long i = 0; x > 0; i++) {
    if (i % 2 == 0)
      co += min(x, 1LL << i);
    else
      ce += min(x, 1LL << i);
    x -= 1LL << i;
  }
  long long se, so, ans;
  se = so = ans = 0;
  se = ((ce % 1000000007) * ((ce + 1) % 1000000007)) % 1000000007;
  so = (((co) % 1000000007) * ((co) % 1000000007)) % 1000000007;
  ans = (se + so) % 1000000007;
  return ans;
}
int main() {
  long long l, r;
  cin >> l >> r;
  if (l > 1) {
    long long ans = (getSum(r) - getSum(l - 1)) % 1000000007;
    if (ans < 0)
      cout << ans + 1000000007 << "\n";
    else
      cout << ans << "\n";
  } else {
    long long ans = (getSum(r)) % 1000000007;
    if (ans < 0)
      cout << ans + 1000000007 << "\n";
    else
      cout << ans << "\n";
  }
  return 0;
}
