#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll dp[63][2][2][2][2][2];
int a[63],b[63],f[10];

int main(void){
	int i,j,k;
	ll l,r,ans=0ll;
	cin >> l >> r;
	for(i=0; i<60; ++i){
		b[i] = l&1; l >>= 1;
		a[i] = r&1; r >>= 1;
	}
	reverse(a,a+60);
	reverse(b,b+60);
	dp[0][1][1][1][0][1] = 1ll;
	for(i=0; i<60; ++i){
		for(j=0; j<128; ++j){
			for(k=0; k<7; ++k){
				f[k] = ((j&(1<<k))?1:0);
			}
			if(f[5] == 0 && f[6] == 1){
				continue;
			}
			if(f[0] && f[5]<f[6]){
				continue;
			}
			if(f[1] && f[5]>a[i]){
				continue;
			}
			if(f[2] && f[6]<b[i]){
				continue;
			}
			if(f[4] && f[3]>f[6]){
				continue;
			}
			add_mod(dp[i+1][((f[0]&&(f[5]==f[6]))?1:0)][((f[1]&&(f[5]==a[i]))?1:0)][((f[2]&&(f[6]==b[i]))?1:0)][f[5]][((f[4] && (f[3]==f[6]))?1:0)],dp[i][f[0]][f[1]][f[2]][f[3]][f[4]]);
		}
	}
	for(j=0; j<32; ++j){
		for(k=0; k<5; ++k){
			f[k] = (j&(1<<k))?1:0;
		}
		if(f[4]){
			continue;
		}
		add_mod(ans,dp[60][f[0]][f[1]][f[2]][f[3]][f[4]]);
	}
	cout << ans << endl;
	return 0;
}
