#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <thread>
#include <tuple>
#include <limits>

using namespace std;

constexpr int mod = 1000000007;

map<tuple<int, long long, long long>, int> result;
long long solve(int sz, long long s, long long e) {
  if (sz == 1) return 1;
  if (sz == 2) return s == e ? 1 : 3;
  auto ccheck = result.emplace(make_tuple(sz, s, e), 0);
  if (!ccheck.second) { return ccheck.first->second; }
  long long len = (1ull << (sz-1));
  long long sublen = len / 2;
  long long ans = 0;
  if (e - s >= sublen) ans += solve(sz - 1, s, e - sublen);
  if (s < sublen) ans += solve(sz - 1, s, min(sublen-1, e));
  if (e >= sublen) ans += solve(sz - 1, max(0ll, s - sublen), e - sublen);
  ccheck.first->second = ans % mod;
  return ans % mod;
}

int main() {
  long long L, R;
  scanf("%lld%lld", &L, &R);
  long long ans = 0;
  for (int sz = 1; sz <= 63; sz++) {
    long long beg = (1ull << (sz - 1));
    long long end = (1ull << sz) - 1;
    if (beg > R) continue;
    if (end < L) continue;
    ans += solve(sz, max(0ll, L-beg), min(end - beg, R - beg));
    ans %= mod;
  }
  printf("%lld\n", ans);
  return 0;
}
