#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){a=b; return true;} return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){a=b; return true;} return false;
}

template<uint_fast64_t Modulus> class modint{
    using u64=uint_fast64_t;
    public:
    u64 a;
    constexpr modint(const u64 x=0) noexcept:a(((x%Modulus)+Modulus)%Modulus){}
    constexpr u64 &value() noexcept{return a;}
    constexpr const u64 &value() const noexcept{return a;}
    constexpr modint &operator+=(const modint &rhs) noexcept{
        a+=rhs.a;
        if (a>=Modulus) a-=Modulus;
        return *this;
    }
    constexpr modint operator+(const modint &rhs) const noexcept{
        return modint(*this)+=rhs;
    }
    constexpr modint &operator++() noexcept{
        return ++a,*this;
    }
    constexpr modint operator++(int) noexcept{
        modint t=*this; return ++a,t;
    }
    constexpr modint &operator-=(const modint &rhs) noexcept{
        if (a<rhs.a) a+=Modulus;
        a-=rhs.a;
        return *this;
    }
    constexpr modint operator-(const modint &rhs) const noexcept{
        return modint(*this)-=rhs;
    }
    constexpr modint &operator--() noexcept{
        return --a,*this;
    }
    constexpr modint operator--(int) noexcept{
        modint t=*this; return --a,t;
    }
    constexpr modint &operator*=(const modint &rhs) noexcept{
        a=a*rhs.a%Modulus;
        return *this;
    }
    constexpr modint operator*(const modint &rhs) const noexcept{
        return modint(*this)*=rhs;
    }
    constexpr modint &operator/=(modint rhs) noexcept{
        u64 exp=Modulus-2;
        while(exp){
            if (exp&1) *this*=rhs;
            rhs*=rhs; exp>>=1;
        }
        return *this;
    }
    constexpr modint operator/(const modint &rhs) const noexcept{
        return modint(*this)/=rhs;
    }
    constexpr modint operator-() const noexcept{
        return modint(Modulus-a);
    }
    constexpr bool operator==(const modint &rhs) const noexcept{
        return a==rhs.a;
    }
    constexpr bool operator!=(const modint &rhs) const noexcept{
        return a!=rhs.a;
    }
    constexpr bool operator!() const noexcept{return !a;}
    friend constexpr modint pow(modint rhs,long long exp) noexcept{
        modint res{1};
        while(exp){
            if (exp&1) res*=rhs;
            rhs*=rhs; exp>>=1;
        }
        return res;
    }
    template<class T> friend constexpr modint operator+(T x,modint y) noexcept{
        return modint(x)+y;
    }
    template<class T> friend constexpr modint operator-(T x,modint y) noexcept{
        return modint(x)-y;
    }
    template<class T> friend constexpr modint operator*(T x,modint y) noexcept{
        return modint(x)*y;
    }
    template<class T> friend constexpr modint operator/(T x,modint y) noexcept{
        return modint(x)/y;
    }
    friend ostream &operator<<(ostream &s,const modint &rhs) noexcept {
        return s << rhs.a;
    }
    friend istream &operator>>(istream &s,modint &rhs) noexcept {
        u64 a; rhs=modint{(s >> a,a)}; return s;
    }
};

using mint=modint<MOD>;

const int MAX=61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll L,R; cin >> L >> R;
    mint dp[MAX+1][2][2][2];
    rep(i,MAX+1) rep(j,2) rep(k,2) rep(l,2){
        dp[i][j][k][l]=0;
    }
    dp[MAX][0][1][1]=1;
    for (int i=MAX-1;i>=0;--i){
        ll a=((1LL<<i)&R),b=((1LL<<i)&L);
        rep(j,2) rep(k,2) rep(l,2){
            mint x=dp[i+1][j][k][l];
            if (!j){
                if (!k&&!l){
                    dp[i][0][0][0]+=x;
                    dp[i][1][0][0]+=x;
                }
                if (!k&&l){
                    if (b) dp[i][1][0][1]+=x;
                    else {
                        dp[i][1][0][0]+=x;
                        dp[i][0][0][1]+=x;
                    }
                }
                if (k&&!l){
                    if (a){
                        dp[i][0][0][0]+=x;
                        dp[i][1][1][0]+=x;
                    } else dp[i][0][1][0]+=x;
                }
                if (k&&l){
                    if (!a&&!b) dp[i][0][1][1]+=x;
                    if (a&&!b){
                        dp[i][0][0][1]+=x;
                        dp[i][1][1][0]+=x;
                    }
                    if (a&&b) dp[i][1][1][1]+=x;
                }
                continue;
            }
            if (!k&&!l) dp[i][1][0][0]+=x*3;
            if (!k&&l){
                if (b) dp[i][1][0][1]+=x;
                else {
                    dp[i][1][0][0]+=x;
                    dp[i][1][0][1]+=x*2;
                }
            }
            if (k&&!l){
                if (a){
                    dp[i][1][0][0]+=x;
                    dp[i][1][1][0]+=x*2;
                } else dp[i][1][1][0]+=x;
            }
            if (k&&l){
                if (!a&&!b) dp[i][1][1][1]+=x;
                if (a&&!b){
                    dp[i][1][0][1]+=x;
                    dp[i][1][1][0]+=x;
                    dp[i][1][1][1]+=x;
                }
                if (a&&b) dp[i][1][1][1]+=x;
            }
        }
    }
    mint ans=0;
    rep(j,2) rep(k,2) rep(l,2) ans+=dp[0][j][k][l];
    cout << ans << endl;
}

Measured memory_bytes: 256