#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }

    ull operator"" _64u(unsigned long long x){ return ull(x); }

#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;

namespace xelmh_RCR {
    class RCR {
        // Residue Class Ring
        static const int64_t NIL = -1;
    public:
        static const int64_t MOD = 1000000007;
//        static const int64_t MOD = 998244353;
        int64_t val;
        RCR(uint l) : val{l % MOD} {}
        RCR() : val{NIL} {}

        bool is_nil() { return val == NIL; }
        RCR pow(RCR m) const {
            RCR rv{1};
            auto nmul = val;
            while (m.val > 0) {
                if ((m.val & 1) == 1) {
                    rv.val *= nmul;
                    rv.val %= MOD;
                }
                nmul *= nmul;
                nmul %= MOD;
                m.val /= 2;
            }
            return rv;
        }
        RCR inv() const { /* return Inverse */ return this->pow(MOD - 2); }
        void operator+=(const RCR &a) {
            val += a.val;
            val %= MOD;
        }
        void operator-=(const RCR &a) {
            val -= a.val;
            if (val < 0) val += MOD;
        }
        void operator*=(const RCR &a) {
            val *= a.val;
            val %= MOD;
        }
        void operator/=(const RCR &a) {
            val *= a.inv().val;
            val %= MOD;
        }
    };

    // supported operator :: + - * / ^
    RCR operator+(const RCR &a, const RCR &b) { return (a.val + b.val) % RCR::MOD; }
    RCR operator-(const RCR &a, const RCR &b) { return (a.val - b.val + RCR::MOD) % RCR::MOD; }
    RCR operator*(const RCR &a, const RCR &b) { return (a.val * b.val) % RCR::MOD; }
    RCR operator/(const RCR &a, const RCR &b) { return (a.val * b.inv().val) % RCR::MOD; }
    RCR operator^(const RCR &a, const RCR &b) { return a.pow(b); }

    bool operator==(const RCR &a, const RCR &b) { return a.val == b.val; }
    bool operator!=(const RCR &a, const RCR &b) { return a.val != b.val; }
    // IO
    std::ostream &operator<<(std::ostream &os, const RCR &m) { return os << m.val; }
    std::istream &operator>>(std::istream &is, RCR &m) { return is >> m.val; }

    RCR fact(ll N) {
        /* N -> N! */
        static vector<RCR> cal(1, RCR{1});

        if (cal.size() > N) return cal[N];
        else {
            RCR nm = fact(N - 1);
            assert(cal.size() == N);
            cal.push_back(nm * N);
            return cal[N];
        }
    }

    RCR choice(ll N, ll k) {
        /* N, k -> N C k */

        // N! / k!(N-k!)
        RCR ans = fact(N) / (fact(k) * fact(N - k));
        return ans;
    }
}
using namespace xelmh_RCR;

vector<vector<RCR>> memo;
ll L, R;

RCR solve(int i, int A, int B, int C){
    ll L0 = L & (1ll << i);
    bool Lcond = L0 == 0 or A;
    ll R1 = R & (1ll << i);
    bool Rcond = R1 > 0 or B;
    ll k = 4*A + 2*B + C;
    if(i < 0) return 1;
    if(memo[i][k] != -1) return memo[i][k];
    RCR ans = 0;

    if(Lcond){
        // xi 0, yi 0
        ans += solve(i-1, A, R1 > 0 ? 1 : B, C);
    }

    if(Lcond and Rcond and C){
        // xi 0, yi 1
        ans += solve(i-1, A, B, C);
    }

    if(Rcond){
        // xi 1, yi 1
        ans += solve(i-1, L0 == 0 ? 1 : A, B, 1);
    }
    memo[i][k] = ans;
    return ans;
}

void sub_main(istream &is) {
    is >> L >> R;
    if(!is) return;
    memo.clear();
    memo.resize(61, vector<RCR>(8, -1));
    cout << solve(60, 0, 0, 0) << endl;


}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_F.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 256