#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int l, r;
long long int sumEven(long long int amount) {
  amount %= mod;
  return (amount) * (amount + 1) % mod;
}
long long int sumOdd(long long int amount) {
  amount %= mod;
  return amount * amount % mod;
}
long long int get(long long int r) {
  long long int even = 0, odd = 0;
  long long int amount = 1;
  long long int now = 0;
  int cnt = 0;
  while (now + amount <= r) {
    now += amount;
    if (cnt == 0)
      odd += amount;
    else
      even += amount;
    amount *= 2;
    cnt = (cnt + 1) & 1;
  }
  if (now < r) {
    if (cnt == 0)
      odd += r - now;
    else
      even += r - now;
  }
  return (sumEven(even) + sumOdd(odd)) % mod;
}
int main() {
  scanf("%lld %lld", &l, &r);
  if (l == 1)
    printf("%lld", get(r));
  else {
    long long int res = get(r) - get(l - 1);
    res = (res % mod + mod) % mod;
    printf("%lld", res);
  }
  return 0;
}
