#include <bits/stdc++.h> 
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// #define ll long long 
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=2*1e5+2;
int dp[64][2][2][2];
bool vis[64][2][2][2];
int get(int l,int r,int d,bool bot,bool top,bool first)
{
	if(d<0) return 1;
	if(vis[d][bot][top][first])
	{
		return dp[d][bot][top][first];
	}
	int ans=0;
	for(int y=0;y<2;y++)
	{
		for(int x=0;x<2;x++)
		{
			if(x>y) continue;
			if((!first)&&(x!=y)) continue;
			int bitr= !!(r&(1LL<<d));
			int bitl= !!(l&(1LL<<d));
			// cout<<bitl<<" "<<bitr<<"\n";
			if(top&&(y>bitr)) continue;
			if(bot&&(x<bitl)) continue;
			ans+=get(l,r,d-1,bot&&(x==bitl),top&&(y==bitr),first||(y>0));
			ans%=MOD;
			// cout<<"*";
		}
	}
	vis[d][bot][top][first]=true;
	// cout<<ans<<" ";
	return dp[d][bot][top][first]=ans;
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int l,r;
	cin>>l>>r;
	cout<<get(l,r,62,true,true,false);
}
// I never lose. I either win or I learn