#include<bits/stdc++.h>
#define ll long long
#define P 1000000007
using namespace std;
ll l,r;
int sk1[100],sk2[100],cnt1,cnt2,dp[100][2][2][2][2];
int dfs(int x,int p,int f1,int f2,int f3){
	if(!x)return 1;
	if(dp[x][p][f1][f2][f3]!=-1)return dp[x][p][f1][f2][f3];
	int ans=0;
	for(int i=0;i<2;++i)if(i<=sk2[x]||!p)
		for(int j=0;j<=i;++j){
			if(!f1&&i&&j)ans+=dfs(x-1,p&&i==sk2[x],1,i>sk1[x],j>sk1[x]);
			else if(!f1&&i==0&&sk1[x]==0)ans+=dfs(x-1,p&&i==sk2[x],0,0,0);
			else if(f1&&(f2||i>=sk1[x])&&(f3||j>=sk1[x]))ans+=dfs(x-1,p&&i==sk2[x],1,f2|(i>sk1[x]),f3|(j>sk1[x]));
			if(ans>=P)ans-=P;
		}
	return dp[x][p][f1][f2][f3]=ans;
}
int solve(){
	while(l){
		sk1[++cnt1]=l&1;
		l>>=1;
	}
	while(r){
		sk2[++cnt2]=r&1;
		r>>=1;
	}
	return dfs(cnt2,1,0,0,0);
}
int main(){
	memset(dp,-1,sizeof(dp));
	scanf("%lld%lld",&l,&r);
	printf("%d",solve());	
}