#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

ll l, r;
ll x[60], y[60];
ll dp[61][2][2][2];

int main() {
    cin >> l >> r;
    rep(i,60) {
        x[i] = l%2;
        y[i] = r%2;
        l /= 2; r /= 2;
    }
    reverse(x, x+60);
    reverse(y, y+60);
    dp[0][0][0][0] = 1;
    rep(i,60) rep(fx,2) rep(fy,2) rep(st,2) {
        // 0 0
        if (fx || x[i] == 0) {
            (dp[i+1][fx][fy||y[i]==1][st] += dp[i][fx][fy][st]) %= MOD;
        }
        // 0 1
        if ((fx || x[i] == 0) && (fy || y[i] == 1) && st == 1) {
            (dp[i+1][fx][fy][st] += dp[i][fx][fy][st]) %= MOD;
        }
        // 1 1
        if (fy || y[i] == 1) {
            (dp[i+1][fx||x[i]==0][fy][1] += dp[i][fx][fy][st]) %= MOD;
        }
    }
    ll ans = 0;
    rep(i,2) rep(j,2) (ans += dp[60][i][j][1]) %= MOD;
    cout << ans << endl;
}