#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=1e9+7;
int f[65][2][2],dl[65],dr[65];
ll l,r;
int dfs(int pos,bool fl,bool fr){
	if (!pos) return 1;
	int &t=f[pos][fl][fr];
	if (~t) return t;
	t=0;int up=fr?dr[pos]:1,dn=fl?dl[pos]:0;
	for (int y=0;y<=up;y++)
		for (int x=dn;x<=y;x++) (t+=dfs(pos-1,fl && x==dn,fr && y==up))%=M;
	return t;
}
int solve(ll l,ll r){
	int lenl=0,lenr=0;
	for (;l;l>>=1) dl[++lenl]=l&1;
	for (;r;r>>=1) dr[++lenr]=r&1;
	int ans=0;
	for (int i=lenl;i<=lenr;i++) (ans+=dfs(i-1,i==lenl,i==lenr))%=M;
	return ans;
}
signed main(){
	memset(f,-1,sizeof(f));
	scanf("%lld%lld",&l,&r);
	printf("%d",solve(l,r));
}