#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

vector<int> l;
vector<int> r;
long long memo[60][2][2][2];

long long f( int pos, int flagX, int flagY, int flagZ )
{
	if( pos == -1 ) return 1;
	if( memo[pos][flagX][flagY][flagZ] >= 0 ) return memo[pos][flagX][flagY][flagZ];
	long long ret = 0;
	if( flagX || l[pos] == 0 ) {
		int flag = flagY;
		if( r[pos] ) flag = 1;
		ret += f( pos - 1, flagX, flag, flagZ );
	}
	if( ( flagX || l[pos] == 0 ) &&
		( flagY || r[pos] ) && flagZ ) {
		ret += f( pos - 1, flagX, flagY, flagZ );
	}
	if( flagY || r[pos] ) {
		int flag = flagX;
		if( l[pos] == 0 ) flag = 1;
		ret += f( pos - 1, flag, flagY, 1 );
	}
	ret %= MOD;
	memo[pos][flagX][flagY][flagZ] = ret;
	return ret;
}

int main()
{
	long long L, R;
	cin >> L >> R;

	while( L ) {
		int b = L % 2;
		l.push_back( b );
		L /= 2;
	}
	int n = 60 - l.size();
	for( int i = 0; i < n; i++ ) l.push_back( 0 );
	while( R ) {
		int b = R % 2;
		r.push_back( b );
		R /= 2;
	}
	n = 60 - r.size();
	for( int i = 0; i < n; i++ ) r.push_back( 0 );
	memset( memo, -1, sizeof( memo ) );
	long long ans = f( 59, 0, 0, 0 );

	cout << ans << endl;
}
