#include <bits/stdc++.h>
#define PII pair<int, int>
#define LL long long
using namespace std;
const int LOG = 65;
const LL MOD = 1000000007;
const LL INF = (LL) 1e9 + 5;

LL L, R, dp[LOG][2][2][2];
bool vis[LOG][2][2][2];
vector<int> d1, d2;

void trans(LL x, vector<int> &d) {
	d.clear();
	for (int i = 0; i < LOG; i++) {
		d.push_back(x % 2);
		x /= 2;
	}
//	cout << "Get:"; for (int x : d) cout << x; cout << '\n';
}

LL dfs(int pos, bool lim1, bool lim2, bool first) {
	if (pos < 0) return 1;
	if (vis[pos][lim1][lim2][first]) return dp[pos][lim1][lim2][first];
	vis[pos][lim1][lim2][first] = true;
	
	int up1 = lim1 ? d1[pos] : 1;
	LL res = 0;
	for (int i = 0; i <= up1; i++) {
		int up2 = lim2 ? min(d2[pos], i) : i;
		for (int j = 0; j <= up2; j++) {
			if (first && i == 1 && j == 0) continue;
			res = (res + dfs(pos - 1, lim1 && i == d1[pos], lim2 && j == d2[pos], first && i == 0)) % MOD;
		}
	}
	
	return dp[pos][lim1][lim2][first] = res;
}

LL solve(LL r1, LL r2) {
	trans(r1, d1);
	trans(r2, d2);
	memset(vis, 0, sizeof(vis));
	return dfs((int) d1.size() - 1, 1, 1, 1);
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> L >> R;
	cout << (solve(R, R) - solve(R, L - 1) + MOD) % MOD << '\n';
	
//	LL bf = 0;
//	for (LL i = L; i <= R; i++) {
//		for (LL j = L; j <= R; j++) {
//			int m1 = 0, m2 = 0, t1 = i, t2 = j;
//			while (t1) t1 >>= 1, m1++;
//			while (t2) t2 >>= 1, m2++;
//			if (m1 != m2) continue;
//			if ((i | j) == i) bf++;
//		}
//	}
//	cout << "BF say " << bf << '\n';
	
	return 0;
}