#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Mint {
    using u64 = std::uint_fast64_t;
    u64 Modulus = MOD;

public:
    u64 a;

    constexpr Mint(const u64 x = 0) noexcept : a(x % Modulus) {}

    constexpr u64 &value() noexcept { return a; }

    constexpr const u64 &value() const noexcept { return a; }

    constexpr Mint operator+(const Mint rhs) const noexcept {
        return Mint(*this) += rhs;
    }

    constexpr Mint operator-(const Mint rhs) const noexcept {
        return Mint(*this) -= rhs;
    }

    constexpr Mint operator*(const Mint rhs) const noexcept {
        return Mint(*this) *= rhs;
    }

    constexpr Mint operator/(const Mint rhs) const noexcept {
        return Mint(*this) /= rhs;
    }

    constexpr Mint &operator+=(const Mint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }

    constexpr Mint &operator-=(const Mint rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }

    constexpr Mint &operator*=(const Mint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }

    constexpr Mint &operator/=(Mint rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }

    constexpr Mint &pow(int rhs) noexcept {
        u64 exp = static_cast<u64>(rhs);
        Mint base(a);
        a = 1;
        while (exp) {
            if (exp % 2) {
                *this *= base;
            }
            base *= base;
            exp /= 2;
        }
        return *this;
    }

};

class Solve {
public:
    string L, R;
    bool flag[100][2][2][2][2][2] = {};
    Mint dp[100][2][2][2][2][2];

    Mint rec(Int n = 0, bool b = false, bool x = 0, bool y = 0, bool u = false, bool l = false) {
        if (flag[n][b][x][y][u][l]) {
            return dp[n][b][x][y][u][l];
        }
        if (n == R.size()) {
//            int val = b && u && l;
            int val = 1;
            return Mint(val);
        }

        Mint ret = 0;


        // L.size()とnの比較でできるかどうかが変わる
        // l == trueなら大丈夫そう
        if (l || (int) (n + L.size() - R.size()) < 0 || L[n + L.size() - (int) R.size()] == '0') {
            ret += rec(n + 1, b, 0, 0, u || (R[n] == '1'), l);
        }

        // 上限満たしていれば大丈夫そう
        // 上限満たしていない場合でもR.size()と比較すれば大丈夫そう
        if (u || R[n] == '1') {
            ret += rec(n + 1, true, 1, 1, u,
                       l || ((int) (n + L.size() - R.size()) < 0 || L[n + L.size() - R.size()] == '0'));
        }

        if (b && (l || (int) (n + L.size() - R.size()) < 0 || L[n + L.size() - R.size()] == '0') &&
            (u || R[n] == '1')) {
//            ret += rec(n + 1, b, 0, 1, u || (R[n] == '1'), l || ((int) (n + L.size() - R.size()) < 0 || L[n + L.size() - R.size()] == '0'));
            ret += rec(n + 1, b, 0, 1, u, l);
        }


        flag[n][b][x][y][u][l] = true;
        return dp[n][b][x][y][u][l] = ret;
    }

    void solve() {
        Int l, r;
        cin >> l >> r;
        while (l > 0) {
            L += (char) ('0' + (l % 2));
            l /= 2;
        }
        while (r > 0) {
            R += (char) ('0' + (r % 2));
            r /= 2;
        }
        reverse(all(L));
        reverse(all(R));

        Mint ans = rec();
        cout << ans.value() << endl;


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 384