#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

ll dp[63][2][2][2][2][2];
const ll MOD = 1000000007;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    ll L, R;
    cin >> L >> R;
    int cnt = 0;
    // for(int i = L; i <= R; i++){
    //     for(int j = i; j <= R; j++){
    //         if((j%i) == (j^i)){
    //             // cout << bitset<10>(i) << ' ' << bitset<10>(j) << endl;
    //             cnt++;
    //         }
    //     }
    // }
    // dp[62][1][1][1][1] = 1;
    bool init = false;
    for(int i = 61; i >= 0; i--){
        ll m_ = (ll)1<<i;
        int s = ((m_&L) > 0) ? 1 : 0;
        int t = ((m_&R) > 0) ? 1 : 0;
        if(t == 0 && !init){
            dp[i][1][1][1][1][0] = 1;
            continue;
        }
        // cout << s << ' ' << t << endl;
        for(int j = 0; j < 2; j++){
            for(int k = 0; k < 2; k++){
                int x1, x2, x3;
                if(j == 1 && k == 1){
                    x1 = 0; x2 = 0, x3 = 0;
                }else if(j == 0 && k == 1){
                    x1 = 0; x2 = 2, x3 = 2;
                }else if(j == 1 && k == 0){
                    x1 = 0; x2 = 0, x3 = 2;
                }else if(j == 0 && k == 0){
                    x1 = 0; x2 = 2, x3 = 4;
                }
                for(int l = 0; l < 2; l++){
                    for(int m = 0; m < 2; m++){
                        int y1, y2, y3;
                        if(l == 1 && m == 1){
                            y1 = 0; y2 = 0, y3 = 0;
                        }else if(l == 0 && m == 1){
                            y1 = 0; y2 = 2, y3 = 2;
                        }else if(l == 1 && m == 0){
                            y1 = 0; y2 = 0, y3 = 2;
                        }else if(l == 0 && m == 0){
                            y1 = 0; y2 = 2, y3 = 4;
                        }
                        for(int x = 0; x < 2; x++){
                            for(int y = 0; y < 2; y++){
                                if(x > y)continue;
                                if((x3+t) < (x2+x)) continue;
                                if((x1+s) > (x2+x)) continue;
                                if((y3+t) < (y2+y)) continue;
                                if((y1+s) > (y2+y)) continue;
                                int j_ = ((x1+s) == (x2+x)) ? 1 : 0;
                                int k_ = ((x3+t) == (x2+x)) ? 1 : 0;
                                int l_ = ((y1+s) == (y2+y)) ? 1 : 0;
                                int m_ = ((y3+t) == (y2+y)) ? 1 : 0;
                                // if(dp[i+1][j][k][l][m] > 0){
                                //     cout << i << ' ' << x << '&' << y << endl;
                                // }
                                dp[i][j_][k_][l_][m_][1] += dp[i+1][j][k][l][m][1];
                                dp[i][j_][k_][l_][m_][1] %= MOD;
                                if(x == 0 && y == 0){
                                    dp[i][j_][k_][l_][m_][0] += dp[i+1][j][k][l][m][0];
                                    dp[i][j_][k_][l_][m_][0] %= MOD;
                                }
                                if(x == 1 && y == 1){
                                    dp[i][j_][k_][l_][m_][1] += dp[i+1][j][k][l][m][0];
                                    dp[i][j_][k_][l_][m_][1] %= MOD;
                                }
                            }
                        }
                    }
                }
            }
        }
        if(t == 1 && !init){
            init = true;
        }
    }
    ll ans = 0;
    for(int j = 0; j < 2; j++){
        for(int k = 0; k < 2; k++){
            for(int l = 0; l < 2; l++){
                for(int m = 0; m < 2; m++){
                    ans += dp[0][j][k][l][m][1];
                    ans %= MOD;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256