#include <iostream>

using namespace std;

typedef long long ll;

ll mod = 1e9 + 7;
ll dp[61][2][2][2];
int main(int argc, char *argv[])
{
	ll L, R;

	cin >> L >> R;

	dp[60][0][0][0] = 1;

	for (int i = 59; i >= 0; i--) {
		int lb = L >> i & 1;
		int rb = R >> i & 1;
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < 2; k++) {
				for (int s = 0; s < 2; s++) {
					ll pre = dp[i + 1][j][k][s] % mod;
					for (int x = 0; x < 2; x++) {
						for (int y = 0; y < 2; y++) {
							if (x && !y) {
								continue;
							}
							int nj = j, nk = k, ns = s;
							if (!s && x != y) {
								continue;
							}
							if (x && y) {
								ns = 1;
							}
							if (!j && !x && lb) {
								continue;
							}
							if (x && !lb) {
								nj = 1;
							}
							if (!k && y && !rb) {
								continue;
							}
							if (!y && rb) {
								nk = 1;
							}
							dp[i][nj][nk][ns] += pre % mod;
							dp[i][nj][nk][ns] %= mod;
						}
					}
				}
			}
		}
	}

	ll ans = 0;
	for (int j = 0; j < 2; j++) {
		for (int k = 0; k < 2; k++) {
			for (int s = 0; s < 2; s++) {
				ans += dp[0][j][k][s] % mod;
				ans %= mod;
			}
		}
	}
	cout << ans << endl;
	return 0;
}