#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll dp[61][2][2]; // 何ケタ目か,L=x or L<x,R=y or y<R
int main() {
	ll L, R;
	cin >> L >> R;
	ll ans = 0;
	for (int n = 0; n <= 60; n++) {
		ll p = 1LL << n;
		ll mask = ~(p - 1);
		if ((L&mask) > p || p > (R&mask)) continue;
		memset(dp, 0, sizeof(dp));
		dp[n][(L&mask) < p][p < (R&mask)] = 1;
		for (int i = n - 1; i >= 0; i--) {
			for (int j = 0; j < 2; j++) {
				for (int k = 0; k < 2; k++) {
					// 0 0
					if (j || ((L >> i) & 1) == 0) {
						(dp[i][j][k | (((R >> i) & 1) == 1)] += dp[i + 1][j][k]) %= MOD;
					}
					// 1 0
					if ((j || ((L >> i) & 1) == 0) && (k || ((R >> i) & 1) == 1)) {
						(dp[i][j][k] += dp[i + 1][j][k]) %= MOD;
					}
					// 1 1
					if (k || ((R >> i) & 1) == 1) {
						(dp[i][j | (((L >> i) & 1) == 0)][k] += dp[i + 1][j][k]) %= MOD;
					}
				}
			}
		}
		for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) (ans += dp[0][i][j]) %= MOD;
	}
	cout << ans << endl;
}