#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)

const int MAX = 1e5 + 10;
const int INF = 1e9;
const int MOD = 1e9 + 7;


int main(){
	long long L; cin >> L;
	long long R; cin >> R;

	long long dp[61][2][2][2] = {};  // Zero initialization.
    dp[60][0][0][0] = 1;

    for(int i = 59; i >= 0; --i){
        int r = R >> i & 1;
        int l = L >> i & 1;

        rep(j, 2)rep(k, 2)rep(s, 2){
            rep(x, 2)rep(y, 2){

                if(y == 0 && x == 1) continue;

                int nj, nk, ns;
                nj = j, nk = k, ns = s;

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

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

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

                dp[i][nj][nk][ns] += dp[i + 1][j][k][s];
                dp[i][nj][nk][ns] %= MOD;
            }
        }

    }

    long long ans = 0;
    rep(j, 2)rep(k, 2)rep(s, 2){
        ans += dp[0][j][k][s];
        ans %= MOD;
    }

    cout << ans << endl;
}
