#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

constexpr Int mod = 1e9+7;
const vector<vector<vector<Int>>> a = {
	{
		{1, 0, 0, 0},
		{0, 1, 0, 0},
		{0, 0, 2, 0},
		{0, 0, 1, 3}
	},
	{
		{1, 0, 0, 0},
		{1, 2, 0, 0},
		{1, 0, 2, 0},
		{0, 1, 1, 3}
	},
	{
		{0, 0, 0, 0},
		{0, 1, 0, 0},
		{0, 0, 1, 0},
		{0, 0, 0, 3}
	},
	{
		{1, 0, 0, 0},
		{0, 2, 0, 0},
		{0, 0, 1, 0},
		{0, 1, 0, 3}
	}
};
Int l, r;
vector<vector<Int>> dp;

vector<Int> p(vector<vector<Int>> b, vector<Int> v){
	vector<Int> res(v.size(), 0);
	for(size_t i=0; i<v.size(); ++i)
		for(size_t j=0; j<b[i].size(); ++j)
			res[i] = (res[i] + (b[i][j] * v[j]) % mod) % mod;
	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> l >> r;
	Int cl = 0;
	while((l >> cl) > 0) ++cl;
	Int cr = 0;
	while((r >> cr) > 0) ++cr;
//	cerr << cr << " " << cl << "\n";
	dp.resize(cr, vector<Int>(4, 0));
	if(cl == cr){
		dp[0][0] = 1;
	}else{
		dp[0][1] = 1;
		for(size_t i=1; (Int)i<cr-cl; ++i) dp[i][3] = 1;
		dp[cr-cl][2] = 1;
	}
//	for(size_t i=0; i<dp.size(); ++i)
//		for(size_t j=0; j<4; ++j)
//			cerr << dp[i][j] << " \n"[j==3];
	for(size_t i=1; i<dp.size(); ++i){
		size_t j = dp.size() - i - 1;
		size_t k = ((l >> j) & 1) * 2 + ((r >> j) & 1);
//		cerr << j << " " << k << "\n";
		vector<Int> t = p(a[k], dp[i-1]);
		for(size_t l=0; l<4; ++l) dp[i][l] = (dp[i][l] + t[l]) % mod;
	}
	Int ans = 0;
	for(auto i:dp.back()) ans = (ans + i) % mod;
	cout << ans << "\n";
//	for(size_t i=0; i<dp.size(); ++i)
//		for(size_t j=0; j<4; ++j)
//			cerr << dp[i][j] << " \n"[j==3];
}