#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;

ll l, r;
ll DP[62][2][2][2];
ll getVal(ll, ll, ll, ll);

int main(){
    for(int i=0; i<62; i++) for(int j=0; j<8; j++){
        DP[i][!(j&4)][!(j&2)][j&1] = -1;
    }
    cin >> l >> r;
    cout << getVal(59, 0, 0, 0);
}

ll getVal(ll a, ll x, ll y, ll z){
    if(a==-1) return 1;
    if(DP[a][x][y][z]!=-1) return DP[a][x][y][z];
    ll ret = 0;
    if(x || !(l & (1LL<<a))){
        ret += getVal(a-1, x, (r&(1LL<<a))?1:y, z);
    }
    if((x || !(l & (1LL<<a))) && (y || (r&(1LL<<a))) && z){
        ret += getVal(a-1, x, y, z);
    }
    if(y || (r&(1LL<<a))){
        ret += getVal(a-1, (!(l&(1LL<<a)))?1:x, y, 1);
    }
    return DP[a][x][y][z] = ret%MOD;
}
