#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<pill,int> PA;
//ll MOD;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	ll weight;
};
ll lef,rig;
ll bekis[60];
int lefs[60],rigs[60];
ll dp[65][2][2][2]={0};//x,yの組であって、左からi桁目、lef以上確定か、rig以下確定か、最上位ビットが一致しているか
int main(){
	cin>>lef>>rig;
	ll now=1;
	rep(i,60){
		lefs[i]=lef%2;
		rigs[i]=rig%2;
		lef/=2;
		rig/=2;
	}
	dp[60][0][0][0]=(ll)1;
	for(int keta=59;keta>=0;keta--){
		
		int lef_each=lefs[keta],rig_each=rigs[keta];
		//cout<<lef_each<<" "<<rig_each<<endl;
		//x=0,y=0;
		int x=0,y=0;
		rep(i,2){
			if(lef_each<=x&&rig_each>=y){
				dp[keta][x-lef_each][rig_each-y][i]+=dp[keta+1][0][0][i];
				dp[keta][x-lef_each][rig_each-y][i]%=MOD;
			}
			if(rig_each>=y){
				dp[keta][1][rig_each-y][i]+=dp[keta+1][1][0][i];
				dp[keta][1][rig_each-y][i]%=MOD;
			}
			if(lef_each<=x){
				dp[keta][x-lef_each][1][i]+=dp[keta+1][0][1][i];
				dp[keta][x-lef_each][1][i]%=MOD;
			}
			dp[keta][1][1][i]+=dp[keta+1][1][1][i];
			dp[keta][1][1][i]%=MOD;
		}
		//x=0,y=1;なにもなし？
		int i=1;
		x=0;y=1;
		if(lef_each<=x&&rig_each>=y){
			dp[keta][x-lef_each][rig_each-y][i]+=dp[keta+1][0][0][i];
			dp[keta][x-lef_each][rig_each-y][i]%=MOD;
		}
		if(rig_each>=y){
			dp[keta][1][rig_each-y][i]+=dp[keta+1][1][0][i];
			dp[keta][1][rig_each-y][i]%=MOD;
		}
		if(lef_each<=x){
			dp[keta][x-lef_each][1][i]+=dp[keta+1][0][1][i];
			dp[keta][x-lef_each][1][i]%=MOD;
		}
		dp[keta][1][1][i]+=dp[keta+1][1][1][i];
		dp[keta][1][1][i]%=MOD;
		
		//x=1,y=1;
		x=1;y=1;
		if(lef_each<=x&&rig_each>=y){
			dp[keta][x-lef_each][rig_each-y][i]+=dp[keta+1][0][0][i];
			dp[keta][x-lef_each][rig_each-y][i]+=dp[keta+1][0][0][0];
			dp[keta][x-lef_each][rig_each-y][i]%=MOD;
		}
		if(rig_each>=y){
			dp[keta][1][rig_each-y][i]+=dp[keta+1][1][0][i];
			dp[keta][1][rig_each-y][i]+=dp[keta+1][1][0][0];
			dp[keta][1][rig_each-y][i]%=MOD;
		}
		if(lef_each<=x){
			dp[keta][x-lef_each][1][i]+=dp[keta+1][0][1][i];
			dp[keta][x-lef_each][1][i]+=dp[keta+1][0][1][0];
			dp[keta][x-lef_each][1][i]%=MOD;
		}
		dp[keta][1][1][i]+=dp[keta+1][1][1][i];
		dp[keta][1][1][i]+=dp[keta+1][1][1][0];
		dp[keta][1][1][i]%=MOD;

	}
	ll ans=0;
	rep(i,2)rep(j,2)rep(k,2){
		//cout<<dp[0][i][j][k]<<" ";
		ans+=dp[0][i][j][k];
		ans%=MOD;
	}
	//cout<<endl;
	cout<<ans<<endl;
}


Measured memory_bytes: 256