#include <bits/stdc++.h>


using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
template<typename A, size_t N, typename T>
void fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}

// ------- auto mod int -------
template<long long Mod>
class ModInt {
public:
    friend class ModInt;
    ModInt(long long x = 0) :x((x% Mod + Mod) % Mod) {}
    constexpr ModInt& operator+=(const ModInt a) {
        if ((x += a.x) >= Mod) x -= Mod;
        return *this;
    }
    constexpr ModInt& operator-=(const ModInt a) {
        if ((x += Mod - a.x) >= Mod) x -= Mod;
        return *this;
    }
    constexpr ModInt& operator*=(const ModInt a) {
        (x *= a.x) %= Mod;
        return *this;
    }
    constexpr ModInt operator+(const ModInt a) const {
        ModInt res(*this);
        return res += a;
    }
    constexpr ModInt operator-(const ModInt a) const {
        ModInt res(*this);
        return res -= a;
    }
    constexpr ModInt operator*(const ModInt a) const {
        ModInt res(*this);
        return res *= a;
    }
    constexpr ModInt pow(long long t) const {
        if (!t) return 1;
        ModInt a = this->pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    constexpr ModInt inv() const {
        return this->pow(Mod - 2);
    }
    constexpr ModInt& operator/=(const ModInt a) {
        return (*this) *= a.inv();
    }
    constexpr ModInt operator/(const ModInt a) const {
        ModInt res(*this);
        return res /= a;
    }
    constexpr bool operator==(const long long a) const {
        return x == a;
    }
    constexpr bool operator!=(const long long a) const {
        return x != a;
    }
    constexpr bool operator<(const long long a) const {
        return x < a;
    }
    constexpr bool operator>(const long long a) const {
        return x > a;
    }
    constexpr bool operator<=(const long long a) const {
        return x <= a;
    }
    constexpr bool operator>=(const long long a) const {
        return x >= a;
    }

    long long x;

};
using mint = ModInt<static_cast<long long>(1e9 + 7)>;

ll l, r;
mint dp[65][2][2][2];
void solve() {
    std::cin >> l >> r;

    dp[60][0][0][0] = 1;
    for (int i = 59; i >= 0; --i) {
        auto lb = (l >> i) & 1;
        auto rb = (r >> i) & 1;

        for (int j = 0; j < 2; ++j)
            for (int k = 0; k < 2; ++k)
                for (int s = 0; s < 2; ++s) {
                    auto val = dp[i + 1][j][k][s];

                    if (val == 0)
                        continue;

                    for (int x = 0; x < 2; ++x)
                        for (int y = 0; y < 2; ++y) {
                            if (x == 1 && y == 0)
                                continue;
                            int nj = j, nk = k, ns = s;

                            if (s == 0 && x != y)
                                continue;
                            if (x == 1 && y == 1)
                                ns = 1;

                            if (j == 0 && x == 0 && lb == 1)
                                continue;
                            if (x == 1 && lb == 0)
                                nj = 1;

                            if (k == 0 && y == 1 && rb == 0)
                                continue;
                            if (y == 0 && rb == 1)
                                nk = 1;

                            dp[i][nj][nk][ns] += val;
                        }
                }
    }

    mint ans;
    for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
            for (int s = 0; s < 2; ++s)
                ans += dp[0][j][k][s];

    std::cout << ans.x << std::endl;

    return;
}


int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);

    solve();

    return 0;
}


Measured memory_bytes: 256