#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

template<int mod> struct ModInt {
    int64_t x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (y % mod + mod) % mod) {}

    ModInt &operator+=(const ModInt &a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &a) {
        x = 1LL * x * a.x % mod;
        return *this;
    }

    ModInt &operator/=(const ModInt &a) {
        *this *= a.inverse();
        return *this;
    }

    ModInt operator-() const {
        return ModInt(-x);
    }

    ModInt operator+(const ModInt a) const {
        return ModInt(*this) += a;
    }

    ModInt operator-(const ModInt a) const {
        return ModInt(*this) -= a;
    }

    ModInt operator*(const ModInt a) const {
        return ModInt(*this) *= a;
    }

    ModInt operator/(const ModInt a) const {
        return ModInt(*this) /= a;
    }

    bool operator==(const ModInt a) const {
        return x == a.x;
    }

    bool operator!=(const ModInt a) const {
        return x != a.x;
    }

    ModInt pow(int64_t k) const {
        ModInt ret(1), mul(x);
        while (k > 0) {
            if (k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }

    ModInt inverse() const {
        return pow(mod - 2);
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
};

const int MOD = 1e9+7;
using modint = ModInt<MOD>;

const int MAX = 61;

ll L, R;

modint dp[63][2][2][2]; // dp[k][l][r][m] 
                        // k bit目までの決め方
                        // l : L <= x が確定している
                        // r : y <= R が確定している
                        // m : MSBが決まっている

int nextR (int k, int check, int bit) {
    if ((R >> k) & 1) {
        if (check == 0 && bit == 1) return 0;
        return 1;
    }
    if (check == 1) return 1;
    if (bit == 0) return 0;
    return -1;
}

int nextL (int k, int check, int bit) {
    if ((L >> k) & 1) {
        if (check == 1) return 1;
        if (bit == 1) return 0;
        return -1;
    }
    if (check == 0 && bit == 0) return 0;
    return 1;
}

modint solve() {
    dp[MAX][0][0][0] = modint(1);
    REPR (k, MAX) {
        REP (y, 2) REP (x, 2) {
            int nl, nr;
            REP (m, 2) {
                nl = nextL(k, x, 0), nr = nextR(k, y, 0);
                if (nl >= 0 && nr >= 0) dp[k][nl][nr][m] += dp[k+1][x][y][m];
                nl = nextL(k, x, 1), nr = nextR(k, y, 1);
                if (nl >= 0 && nr >= 0) dp[k][nl][nr][1] += dp[k+1][x][y][m];
            }
            nl = nextL(k, x, 0), nr = nextR(k, y, 1);
            if (nl >= 0 && nr >= 0) dp[k][nl][nr][1] += dp[k+1][x][y][1];
        }
    }

    modint ans;
    REP (a, 2) REP (b, 2)
        ans += dp[0][a][b][1];
    return ans;
}

int main() {
    cin >> L >> R;
    cout << solve() << endl;
}

Measured memory_bytes: 256