#include <bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
int dp[64][2][2][2];
 
signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	IOS;
	int l, r;
	cin >> l >> r;
	dp[61][1][1][0] = 1;
	for(int i = 61; i >= 1; i--){
		for(int x = 0; x < 2; x++){
			for(int y = 0; y < 2; y++){
				for(int a = 0; a < 2; a++){
					if(dp[i][x][y][a] == 0)	continue;
					bool l1 = (l & (1LL << (i-1))), r1 = (r & (1LL << (i-1)));
					// cout << i << " " << x << " " << y << " " << a << " " << dp[i][x][y][a] << endl;
					for(int j = 0; j < 2; j++){
						for(int k = 0; k < 2; k++){
							if(j > k)	continue;
							if(x && j < l1)	continue;
							if(y && k > r1)	continue;
							if(!a && j != k)	continue;	
							bool xx = x & (j == l1);
							bool yy = y & (k == r1);
							bool aa = a | j;
							dp[i-1][xx][yy][aa] += dp[i][x][y][a];
							dp[i-1][xx][yy][aa] %= mod;
						}
					}
				}
			}
		}
	}
	int ans = 0;
	for(int i = 0; i < 2; i++)
		for(int j = 0; j < 2; j++)
			ans = (ans + dp[0][i][j][1]) % mod;
	cout << ans << endl;
	return 0;
}