#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
const ll mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

mint dp[60][4];

int main(){
    ll l, r;
    cin >> l >> r;
    mint ans(0);
    //dp[60][3] = mint(1);
    ll ml = 0;
    ll mr = 0;
    while ((l>>ml)>1) ml++;
    while ((r>>mr)>1) mr++;

    for (int i=59; i>=0; i--) {
        ll il = l>>i & 1;
        ll ir = r>>i & 1;
        if (i<=mr) {
            if (i==mr && i==ml) dp[i][3] += 1;
            if (i==mr && i>ml) dp[i][2] += 1;
            if (i<mr && i>ml) dp[i][0] += 1;
            if (i<mr && i==ml) dp[i][1] += 1;
        }


        dp[i][0] += dp[i+1][0]*3;//1
        if (il==0 && ir==0) {
            dp[i][1] += dp[i+1][1]*2;//2
            dp[i][2] += dp[i+1][2];//3
            dp[i][3] += dp[i+1][3];//4
            dp[i][0] += dp[i+1][1];//5
            ;//6
            ;//8
            //dp[i][2] += dp[i+1][3];//9
        }
        if (il==0 && ir==1) {
            dp[i][1] += dp[i+1][1]*2;//2
            dp[i][2] += dp[i+1][2]*2;//3
            dp[i][3] += dp[i+1][3];//4
            dp[i][0] += dp[i+1][1];//5
            dp[i][0] += dp[i+1][2];//6
            dp[i][1] += dp[i+1][3];//8
            dp[i][2] += dp[i+1][3];//9
        }
        if (il==1 && ir==0) {
            dp[i][1] += dp[i+1][1];//2
            dp[i][2] += dp[i+1][2];//3
            ;//4
            ;//5
            ;//6
            ;//8
            ;//9
        }
        if (il==1 && ir==1) {
            dp[i][1] += dp[i+1][1];//2
            dp[i][2] += dp[i+1][2]*2;//3
            dp[i][3] += dp[i+1][3];//4
            ;//5
            dp[i][0] += dp[i+1][2];//6
            //dp[i][1] += dp[i+1][3];//8
            ;//9
        }
    }
    
    rep(i, 4) ans += dp[0][i];
    //rep(i, 4) debug(dp[0][i].x);
    
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 256