#include <bits/stdc++.h>

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 150, inf = 1000111222, mod = 1000000007;

string tostr(ll a) {
    string s;
    while (a) {
        s += '0' + (a % 2);
        a /= 2;
    }
    return s;
}

ll dp[100];
ll dpt[100];
ll dpf[100];
ll p3[max_n];

ll solve(ll from, ll to) {
    //cout << from << ' '<< to << endl;
    string f = tostr(from), t = tostr(to);
    //cout << f << endl;
    //cout << t << endl;

    if (f.size() != t.size()) {
        exit(228);
    }
    if (f.back() != '1' || t.back() != '1') {
        exit(228);
    }
    memset(dp, 0, sizeof(dp));
    memset(dpf, 0, sizeof(dpf));
    memset(dpt, 0, sizeof(dpt));
    for (int i = 0; i < f.size(); ++i) {
        if (f[i] == '1') {
            if (i == 0) {
                dpf[i] = 1;
            } else {
                dpf[i] = dpf[i - 1];
            }
        } else {
            if (i == 0) {
                dpf[i] = 3;
            } else {
                dpf[i] = (2LL * dpf[i - 1]) % mod;
                dpf[i] += p3[i];
                dpf[i] %= mod;
            }
        }
    }
    for (int i = 0; i < t.size(); ++i) {
        if (t[i] == '0') {
            if (i == 0) {
                dpt[i] = 1;
            } else {
                dpt[i] = dpt[i - 1];
            }
        } else {
            if (i == 0) {
                dpt[i] = 3;
            } else {
                dpt[i] = (2LL * dpt[i - 1]) % mod;
                dpt[i] += p3[i];
                dpt[i] %= mod;
            }
        }
    }

    for (int i = 0; i < f.size(); ++i) {
        if (f[i] == '1' && t[i] == '0') {
            dp[i] = 0;
        }
        if (f[i] == '0' && t[i] == '1') {
            if (i == 0) {
                dp[i] = 3;
            } else {
                dp[i] = (dpt[i - 1] + dpf[i - 1] + dp[i - 1]) % mod;
            }
        }
        if (f[i] == '1' && t[i] == '1') {
            if (i == 0) {
                dp[i] = 1;
            } else {
                dp[i] = dp[i - 1];
            }
        }
        if (f[i] == '0' && t[i] == '0') {
            if (i == 0) {
                dp[i] = 1;
            } else {
                dp[i] = dp[i - 1];
            }
        }
    }
    //cout << "$ " << dp[0] << ' ' << dpt[0] << ' ' << dpf[0] << endl;
    return dp[f.size() - 1];
}

int dumb(int l, int r) {
    int ans =0;
    for (int i = l; i <= r; ++i) {
        for (int j = i; j <= r; ++j) {
            if (j % i == (j ^ i)) {
                ++ans;
            }
        }
    }
    return ans;
}

int32_t main()
{
    //freopen("input.txt", "r", stdin);
    ll l, r;
    cin >> l >> r;
    p3[0] = 1;
    for (int i = 1; i < 100; ++i) {
        p3[i] = (3LL * p3[i - 1]) % mod;
    }
    vector<pair<ll, ll>> ft, nd;
    ll from = 1;
    while(true) {
        ft.emplace_back(from, from * 2 - 1);
        from *= 2;
        if (from > 1e18) {
            break;
        }
    }
    for (pair<ll, ll> p : ft) {
        if (l > p.S || r < p.F) {
            continue;
        }
        nd.emplace_back(max(l, p.F), min(r, p.S));
    }
    ll ans = 0;
    //cout << solve(l, r) << ' ' << dumb(l, r) << endl;
    //exit(0);
    for (pair<ll, ll> p : nd) {
        ans += solve(p.F, p.S);
        ans %= mod;
        //cout << "F " << solve(p.F, p.S) << ' ' << dumb(p.F, p.S) << endl;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256