// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

ll dp[64][2][2][2];

const ll mod = 1e9 + 7;

int main() {
    ll L, R;
    cin >> L >> R;

    ll msb_r = 63;
    for(; !((R >> msb_r) & 1); msb_r--);
    if(!((L >> msb_r) & 1)) {
        dp[msb_r][1][0][1] = 1;
        dp[msb_r][0][1][0] = 1;
    } else {
        dp[msb_r][0][0][1] = 1;
    }
    DEBUG(make_tuple(bitset<64>(L).to_string(), bitset<64>(R).to_string(), msb_r));

    for(ll b = msb_r - 1; 0 <= b; b--) {
        bool enable_l = ((L >> b) & 1);
        bool enable_r = ((R >> b) & 1);
        for(ll pre = 0; pre < 8; pre++) {
            const ll pre_l_idx = pre & 1;
            const ll pre_r_idx = (pre >> 1) & 1;
            const ll pre_msb_idx = (pre >> 2) & 1;
            ll nxt_l_idx, nxt_r_idx, nxt_msb_idx;
            
            auto check = [&](ll nxt_l, ll nxt_r) {
                if(!pre_l_idx && enable_l && !nxt_l) return false;
                if(!pre_r_idx && !enable_r && nxt_r) return false;
                if(nxt_l != nxt_r && !pre_msb_idx) return false;
                nxt_l_idx = (pre_l_idx ? 1ll : static_cast<ll>(nxt_l != enable_l));
                nxt_r_idx = (pre_r_idx ? 1ll : static_cast<ll>(nxt_r != enable_r));
                nxt_msb_idx = (pre_msb_idx ? 1ll : static_cast<ll>(nxt_l == 1));
                DEBUG(make_tuple(pre_l_idx, nxt_l, enable_l, nxt_l_idx));
                DEBUG(make_tuple(pre_r_idx, nxt_r, enable_r, nxt_r_idx));
                return true;
            };

            auto update = [&](ll nxt_l, ll nxt_r) { 
                if(check(nxt_l, nxt_r)) (dp[b][nxt_l_idx][nxt_r_idx][nxt_msb_idx] += dp[b + 1][pre_l_idx][pre_r_idx][pre_msb_idx]) %= mod;
            };

             update(0, 0); // l == 0, r == 0
             update(0, 1); // l == 0, r == 1
             update(1, 1); // l == 1, r == 1
        }
    }

    ll ans = 0;
    for(ll i = 0; i < 8; i++) (ans += dp[0][i & 1][(i >> 1) & 1][(i >> 2) & 1]) %= mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256