#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)


struct ModInt
{
    static int _BM;
    long long int m_value;

    int getint() const { return (int) m_value; }
    void _mod() 
    {
        if( m_value < 0 ) m_value += ((-m_value) / _BM + 1) * _BM;
        m_value %= _BM;
    }
    ModInt() { m_value = 0; }
    ModInt(int v) { m_value = (_LL) v; _mod(); }
    ModInt(_LL v) { m_value = (_LL) v; _mod(); }    
    ModInt(const ModInt &t) { m_value = t.getint(); }
    ModInt& operator += ( int v ) { m_value += v; _mod(); return *this; }
    ModInt& operator -= ( int v ) { m_value -= v; _mod(); return *this; }
    ModInt& operator *= ( int v ) { m_value *= v; _mod(); return *this; }
    ModInt& operator += ( _LL v ) { return (*this) += (int)(v % _BM); }
    ModInt& operator -= ( _LL v ) { return (*this) -= (int)(v % _BM); }
    ModInt& operator *= ( _LL v ) { return (*this) *= (int)(v % _BM); }
    ModInt& operator += ( const ModInt &t ) { (*this) += t.getint(); return (*this); }
    ModInt& operator *= ( const ModInt &t ) { (*this) *= t.getint(); return (*this); }
    ModInt& operator -= ( const ModInt &t ) { (*this) -= t.getint(); return (*this); }
    static int reciprocal(_LL a)
    {
        _LL b = _BM, u = 1, v = 0;
        while (b) {
            _LL t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        u %= _BM; 
        if (u < 0) u += _BM;
        return (int)u;
    }
    static int reciprocal(int a) { return reciprocal((_LL) a); }

    ModInt& operator /= ( const ModInt &t ) { (*this) /= t.getint(); return (*this); }
    ModInt& operator /= ( int v ) { (*this) *= reciprocal(v); return *this; }    
    ModInt& operator /= ( _LL v ) { (*this) *= reciprocal(v); return *this; }    
    const ModInt operator + (const ModInt &t) const { ModInt ans(*this); return ans += t; }
    const ModInt operator + (int t)  const { ModInt ans(*this); return ans += t; }
    const ModInt operator + (_LL t)  const { ModInt ans(*this); return ans += t; }        
    const ModInt operator - (const ModInt &t) const { ModInt ans(*this); return ans -= t; }
    const ModInt operator - (int t)  const { ModInt ans(*this); return ans -= t; }
    const ModInt operator - (_LL t)  const { ModInt ans(*this); return ans -= t; }        
    const ModInt operator * (const ModInt &t) const { ModInt ans(*this); return ans *= t; }
    const ModInt operator * (int t)  const { ModInt ans(*this); return ans *= t; }
    const ModInt operator * (_LL t)  const { ModInt ans(*this); return ans *= t; }
    const ModInt operator / (const ModInt &t) const { ModInt ans(*this); return ans /= t; }
    const ModInt operator / (int t)  const { ModInt ans(*this); return ans /= t; }
    const ModInt operator / (_LL t)  const { ModInt ans(*this); return ans /= t; }

    bool operator == (int t) { return getint() == t; }

    static int modadd( int a, int b ) { ModInt t(a); t += b; return t.getint(); }
    static int modminus( int a, int b ) { ModInt t(a); t -= b; return t.getint(); }
    static int modmul( int a, int b ) { ModInt t(a); t *= b; return t.getint(); }
    static int modadd( _LL a, _LL b ) { ModInt t(a); t += b; return t.getint(); }
    static int modminus( _LL a, _LL b ) { ModInt t(a); t -= b; return t.getint(); }    
    static int modmul( _LL a, _LL b ) { ModInt t(a); t *= b; return t.getint(); } 
    static int modpow(int a, int b) { return modpow((_LL) a, (_LL)b); }
    static int modpow(_LL a, _LL b)
    {
        ModInt ans(1);
        int heap[64];
        heap[0] = (a % _BM);
        for( int bit = 0; b >= (((_LL)1) << bit); bit++ )
        {
            if( bit > 0 ) heap[bit] = modmul( heap[bit - 1], heap[bit - 1] );
            if( b & (((_LL)1) << bit) )
            {
                ans *= heap[bit];
            }
        }
        return ans.getint();
    }

    static int getCombination(_LL n, _LL r)
    {
        _LL ans;
        ans = 1;
        for(_LL i = 0; i < r; i++) ans = modmul(ans, n - i);
        _LL inv = 1;
        for(_LL i = 0; i < r; i++) inv = modmul(inv, i + 1);
        return modmul(ans, (_LL) reciprocal(inv));
    }

    static int combination(int n, int r)
    {
        int *fac = (int *)malloc(sizeof(int) * (n + 1));
        int *facinv = (int *)malloc(sizeof(int) * (n + 1));
        fac[0] = 1;
        for( int k = 1; k <= n; k++) fac[k] = modmul(k, fac[k - 1]);
        facinv[n] = reciprocal( fac[n] );
        for( int k = n ; k > 0; k--) facinv[k - 1] = modmul(k, facinv[k]);

        ModInt ans(fac[n]);
        ans *= facinv[r];
        ans *= facinv[n - r];

        free(fac);
        free(facinv);
        return ans.getint();
    }
};

int ModInt::_BM = 1000000007;


ModInt getbittotal(_LL bit, _LL lmin, _LL lmax )
{
    ModInt dp1[4];
    ModInt dp2[4];
    ModInt *current = dp1;
    ModInt *next = dp2;
    dp1[0] = 1; // 最大最小の制限あり
    dp1[1] = 0; // 最大の制限なし
    dp1[2] = 0; // 最小の制限なし
    dp1[3] = 0; // 制限なし

    for( _LL b = bit - 1; b >= 0; b-- )
    {
        _LL minbit = (((lmin & (1LL << b)) != 0) ? 1 : 0);
        _LL maxbit = (((lmax & (1LL << b)) != 0) ? 1 : 0);
        if( minbit == 1 && maxbit == 1 ) 
        {
            next[0] = current[0];
            next[1] = current[1];
            next[2] = current[2] * 2;
            next[3] = current[2] + current[3] * 3;
        }
        if( minbit == 0 && maxbit == 1 ) 
        {
            next[0] = current[0];
            next[1] = current[0] + current[1] * 2;
            next[2] = current[0] + current[2] * 2;
            next[3] = current[1] + current[2] + current[3] * 3;
        }
        if( minbit == 1 && maxbit == 0 ) 
        {
            next[0] = 0;
            next[1] = current[1];
            next[2] = current[2];
            next[3] = current[3] * 3;
        }
        if( minbit == 0 && maxbit == 0 )
        {
            next[0] = current[0];
            next[1] = current[1] * 2;
            next[2] = current[2];
            next[3] = current[1] + current[3] * 3;
        }
        swap(current, next);
    }
    ModInt ret = 0;
    rep(j, 4) ret += current[j];
    return ret;
}

int main()
{
    _LL l, r; cin >> l >> r;
    _LL lbit = 0; while( l >= (1LL << (1 + lbit))) lbit++;
    _LL rbit = 0; while( r >= (1LL << (1 + rbit))) rbit++;
    ModInt ans = 0;
    for(_LL bit = lbit; bit <= rbit; bit++)
    {
        ans += getbittotal(bit, (lbit == bit) ? l : (1LL << bit), (rbit == bit) ? r : ( (1LL << (bit + 1) ) - 1 ) );
    }
    
    cout << ans.getint() << endl;

#if 0    
    for(int x = 32; x + 1 < 64; x++)
    {
        for(int y = x + 1; y < 64; y++)
        {
            int xr = (x ^ y);
            int diff = y % x;
            if( (~y) & x ) cout << "!!!";
            cout << x << "," << y << " : " << (x ^ y) << " <->"  << y % x << endl;
        }
    }
#endif    
    return 0;    
}

Measured memory_bytes: 3588