#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int n = 62;
const long long M = 1000000007;

long long ll, rr;

long long dp[n + 2][2][2][2];

int main()
{
    //freopen("input.txt", "r", stdin);
    cin >> ll >> rr;
    /*long long sans = 0;
    for (int y = ll; y <= rr; ++y)
    {
        int q = 0;
        for (int x = ll; x <= y; ++x)
        {
            if ((y ^ x) == (y % x))
            {
                //cout << y << ' ' << x << endl;
                ++q;
            }
        }
        //cout << y << ' ' << q << endl;
        sans += q;
    }
    cout << sans << endl;*/
    dp[n][1][1][1] = 1;
    for (int i = n; i > 0; --i)
    {
        for (int l = 0; l < 2; ++l)
        {
            for (int r = 0; r < 2; ++r)
            {
                for (int u = 0; u < 2; ++u)
                {
                    vector<pair<int, int> > lv, rv;
                    if (l == 0)
                    {
                        lv.push_back(m_p(0, 0));
                        lv.push_back(m_p(1, 0));
                    }
                    else
                    {
                        if ((ll & (1LL << (i - 1))))
                        {
                            lv.push_back(m_p(1, 1));
                        }
                        else
                        {
                            lv.push_back(m_p(0, 1));
                            lv.push_back(m_p(1, 0));
                        }
                    }
                    if (r == 0)
                    {
                        rv.push_back(m_p(0, 0));
                        rv.push_back(m_p(1, 0));
                    }
                    else
                    {
                        if ((rr & (1LL << (i - 1))))
                        {
                            rv.push_back(m_p(0, 0));
                            rv.push_back(m_p(1, 1));
                        }
                        else
                        {
                            rv.push_back(m_p(0, 1));
                        }
                    }
                    for (int ii = 0; ii < lv.size(); ++ii)
                    {
                        for (int jj = 0; jj < rv.size(); ++jj)
                        {
                            if (lv[ii].first == 1 && rv[jj].first == 0)
                                continue;
                            if (u == 1 && !((lv[ii].first == 0 && rv[jj].first == 0) || (lv[ii].first == 1 && rv[jj].first == 1)))
                                continue;
                            int uu;
                            if (u == 1 && lv[ii].first == 0 && rv[jj].first == 0)
                                uu = 1;
                            else
                                uu = 0;
                            dp[i - 1][lv[ii].second][rv[jj].second][uu] = (dp[i - 1][lv[ii].second][rv[jj].second][uu] + dp[i][l][r][u]) % M;
                        }
                    }
                }
            }
        }
    }
    long long ans = 0;
    for (int l = 0; l < 2; ++l)
    {
        for (int r = 0; r < 2; ++r)
        {
            for (int u = 0; u < 2; ++u)
            {
                ans = (ans + dp[0][l][r][u]) % M;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256