#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


// Modint
struct Mint {
    static const long long mod = (long long)(1e9 + 7);
    long long val;

    Mint() { val = 0; }
    Mint(long long a) { val = a; verify_value(); }

    void verify_value() {
        if (val >= mod) val %= mod;
        if (val < 0) val %= mod, val += mod;
    }

    Mint pow(long long p) const {
        Mint cur = Mint(val), ret = 1;
        while (p > 0) {
            if (p & 1) ret *= cur;
            cur *= cur;
            p >>= 1LL;
        }
        return ret;
    }
    Mint inv() const {
        if (val == 0)
            std::cerr << "WARNING: inv() is called with 0." << std::endl;
        return pow(mod - 2);
    }

    Mint operator+() const { return *this; }
    Mint operator-() const { return Mint(mod - val); }

    Mint operator+=(const Mint &a) {
        val += a.val;
        if (val >= mod) val -= mod;
        return Mint(val);
    }
    Mint operator*=(const Mint &a) {
        val *= a.val;
        if (val >= mod) val %= mod;
        return Mint(val);
    }
    Mint operator-=(const Mint &a) { return *this += -a; }
    Mint operator/=(const Mint &a) { return *this *= a.inv(); }

    Mint operator++() { return *this += Mint(1); }
    Mint operator--() { return *this -= Mint(1); }
    Mint operator++(int) {
        Mint ret = *this;
        ++(*this);
        return ret;
    }
    Mint operator--(int) {
        Mint ret = *this;
        --(*this);
        return ret;
    }

    operator long long() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
    long long ret = a.val + b.val;
    if (ret >= Mint::mod) ret -= Mint::mod;
    return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
    long long ret = a.val * b.val;
    if (ret >= Mint::mod) ret %= Mint::mod;
    return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

std::ostream &operator<<(std::ostream &out, const Mint &a) { return out << a.val; }
std::istream &operator>>(std::istream &in, Mint &a) {
    in >> a.val;
    a.verify_value();
    return in;
}

Mint pow(Mint a, long long b) {
    return a.pow(b);
}


int main() {
    long long L, R; std::cin >> L >> R;
    std::vector<int> l, r;
    for (int i = 0; i < 60; i++) {
        l.push_back((L >> i) & 1);
        r.push_back((R >> i) & 1);
    }
    std::reverse(l.begin(), l.end());
    std::reverse(r.begin(), r.end());
    std::vector<std::vector<Mint>> dp(60, std::vector<Mint>(8));
    auto func = [&](const auto &self, int pos=0,
            bool lflag=true, bool rflag=true, bool msbflag=false) {
        if (pos >= 60) return Mint(1);
        int flagid = lflag + 2 * rflag + 4 * msbflag;
        if (dp[pos][flagid] != 0) return dp[pos][flagid];

        if (!lflag || l[pos] == 0)
            dp[pos][flagid] += self(self, pos + 1,
                lflag && l[pos] == 0, rflag && r[pos] == 0, msbflag);
        if (!rflag || r[pos] == 1)
            dp[pos][flagid] += self(self, pos + 1,
                lflag && l[pos] == 1, rflag && r[pos] == 1, true);
        if (msbflag && (!lflag || l[pos] == 0) && (!rflag || r[pos] == 1))
            dp[pos][flagid] += self(self, pos + 1,
                lflag && l[pos] == 0, rflag && r[pos] == 1, msbflag);
        return dp[pos][flagid];
    };
    func(func);
    std::cout << dp[0][3] << std::endl;
    return 0;
}


Measured memory_bytes: 256