#include <bits/stdc++.h>
using namespace std;
vector<int> months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const long long MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double eps = 1e-7;
long long l, r;
long long odd, even;
long long power(long long first, long long second) {
  if (!second) return 1;
  long long res = power(first, second / 2ll);
  res = (res * res) % MOD;
  if (second & 1ll) res = (res * (first % MOD)) % MOD;
  return res;
}
void _count(long long n) {
  bitset<64> b(0);
  int en = 0;
  odd = even = 0;
  for (int i = 0; i < 64; ++i) {
    b[i] = 1;
    long long first = b.to_ullong();
    en = i;
    if (first > n) {
      b[i] = 0;
      first = b.to_ullong();
      if (i & 1)
        even = n - first;
      else
        odd = n - first;
      break;
    }
  }
  for (int i = 0; i < en; ++i) {
    if (i & 1)
      even += 1ll << i;
    else
      odd += 1ll << i;
  }
}
long long solve(long long n) {
  _count(n);
  long long res1 = odd % MOD;
  res1 = (res1 * ((2ll * odd) % MOD)) % MOD;
  res1 = (res1 * power(2ll, MOD - 2));
  long long res2 = even % MOD;
  res2 = (res2 * ((2ll * even + 2ll) % MOD)) % MOD;
  res2 = (res2 * power(2ll, MOD - 2));
  long long res = (res1 + res2) % MOD;
  return res;
}
int main() {
  scanf("%I64d", &l);
  scanf("%I64d", &r);
  long long res = solve(r);
  if (l > 1) res -= solve(l - 1);
  res += MOD;
  res %= MOD;
  printf("%I64d", res);
  return 0;
}
