#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,ssse3,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
//using arr = array;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 1<<12, mod = 1e9 + 7 , lg = 19;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll L, R;
ll dp[66][2][2][2];
#define get(x, y) (((x)>>(y))&1)
ll rec(ll i, ll a, ll b, ll c) {
	if(i>=60) return a+b==0&&c;
	if(dp[i][a][b][c]>-1) return dp[i][a][b][c];
	ll &ans = dp[i][a][b][c];
	ans = 0;
	for(int r = 0; r < 2; r++)
		for(int l = 0; l < 2; l++) {
			if(l>r) continue;
			ans += rec(i+1, get(R, i)!=r?r>get(R, i):a, get(L, i)!=l?l<get(L, i):b, r+l==0?c:(r&&l));
			ans %= mod;
		}
	return ans;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	memset(dp, -0x3f, sizeof dp);
	cin >> L >> R;
	cout << rec(0, 0, 0, 0);
	return 0;
}
