#include <iostream>
#include <algorithm>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int mod = 1000000007;

int calc(int keta, int lowerX, int upperY) {
	int dp[61][2][2] = {0};
	int i, j, k, nx, ny;
	
	dp[keta][0][0] = 1;
	for (i = keta; i > 0; i--) {
		int digX = (lowerX >> (i - 1)) % 2;
		int digY = (upperY >> (i - 1)) % 2;
		rep(j, 2) {
			rep(k, 2) {
				rep(nx, 2) {
					if (j == 0 && nx == 0 && digX == 1) {
						continue;
					}
					rep(ny, 2) {
						if (nx == 1 && ny == 0) continue;
						if (k == 0 && ny == 1 && digY == 0) {
							continue;
						}
						
						int nj = ((j == 1) || (nx > digX));
						int nk = ((k == 1) || (ny < digY));
						
						(dp[i - 1][nj][nk] += dp[i][j][k]) %= mod;
					}
				}
			}
		}
	}
	
	//dp[0][*][*]
	int ret = 0;
	rep(j, 2) rep(k, 2) ret += dp[0][j][k];
	ret %= mod;
	return ret;
}

signed main() {
	int l, r;
	cin >> l >> r;
	
	int ans = 0;
	for (int i = 0; i < 60; i++) {
		int lowerX = l - (1LL << i);
		int upperY = r - (1LL << i);
		if (upperY < 0 || lowerX >= (1LL << i)) continue;
		lowerX = max(0LL, lowerX);
		upperY = min((1LL << i) - 1, upperY);
		int res = calc(i, lowerX, upperY);
		ans += res;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}