#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 const int mod=1e9+7; 
 ll L,R; ll f[64][2][2][2][2];
 int l[100],r[100]; 
 ll dfs(int x,int fl,int fr,int s,int ht)
 {	if(x<0)return 1;
 	ll &ans=f[x][fl][fr][s][ht];
	 	if(ans)return ans;	
		 	for(int i=0;i<2;i++)
			 	{		for(int j=0;j<2;j++){		
				 	int tl=fl,tr=fr,ts=s,tt=ht;		
					 	if(!tt&&i)if(i!=j)continue;	
						 		if((j&i)!=j)continue;	
								 		if(!tl&&j<l[x])continue;
										 			if(!tr&&i>r[x])continue;
													 	
										if(j>l[x])tl=1;if(i<r[x])tr=1;if(j<i)ts=1;if(j)tt=1;	
												ans+=dfs(x-1,tl,tr,ts,tt);
													}
				}
	ans%=mod;	return ans;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);	
		cin>>L>>R;
			for(int i=63;i>=0;i--)	{
					l[i]=(bool)((1ll<<i)&L);r[i]=(bool((1ll<<i)&R));
						}		
						cout<<dfs(63,0,0,0,0);	
							return 0;
}
							
