// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

ll dp[65][2][2][2][2][2][2];
int main() {
    ll L, R; cin >> L >> R;

    if(false) {
        for(int x=L; x<=R; x++) {
            for(int y=x; y<=R; y++) {
                int vl = y % x;
                int vr = y ^ x;
                if(vl == vr) fprintf(stderr, "x = %d, y = %d, and = %d, xor = %d\n", x, y, (x & y), (x ^ y));
            }
        }
    }
        
    string s = "";
    ll NL = L, NR = R;
    while(NL) {
        s += (char)('0' + (NL & 1));
        NL >>= 1;
    }
    string t = "";
    while(NR) {
        t += (char)('0' + (NR & 1));
        NR >>= 1;
    }

    while(s.size() < t.size()) s += "0";
    reverse(s.begin(), s.end());
    reverse(t.begin(), t.end());
    // cout << s << endl << t << endl;

    dp[0][0][0][0][0][0][0] = 1;
    int N = s.length();
    for(int i=0; i<N; i++) {
        // x: less (未満), more (超過)
        for(int f1x=0; f1x<2; f1x++) {
            for(int f2x=0; f2x<2; f2x++) {
                int lim_rx = f1x ? 1 : t[i] - '0';
                int lim_lx = f2x ? 0 : s[i] - '0';
                
                // y: less, more
                for(int f1y=0; f1y<2; f1y++) {
                    for(int f2y=0; f2y<2; f2y++) {
                        for(int l1=0; l1<2; l1++) {
                            for(int l2=0; l2<2; l2++) {                        
//                                printf("dp[%d][%d][%d][%d][%d][%d][%d] = %lld\n", i, f1x, f2x, f1y, f2y, l1, l2, dp[i][f1x][f2x][f1y][f2y][l1][l2]);
                                
                                int lim_ry = f1y ? 1 : t[i] - '0';
                                int lim_ly = f2y ? 0 : s[i] - '0';
                        
                                for(int x=lim_lx; x<=lim_rx; x++) {
                                    for(int y=lim_ly; y<=lim_ry; y++) {
                                        bool n_f1x = f1x || x < lim_rx;
                                        bool n_f2x = f2x || x > lim_lx;
                                        bool n_f1y = f1y || y < lim_ry;
                                        bool n_f2y = f2y || y > lim_ly;
                                        bool n_l1 = l1 || x > 0;
                                        bool n_l2 = l2 || y > 0;
                                        
                                        if(x == 1 and y == 0) continue;
                                        if(x == 1 and n_l2 == false) continue;
                                        if(y == 1 and n_l1 == false) continue;
                                        (dp[i+1][n_f1x][n_f2x][n_f1y][n_f2y][n_l1][n_l2] += dp[i][f1x][f2x][f1y][f2y][l1][l2]) %= MOD;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    // どっちも L < x, y < R のとき
    ll ans = 0;
    for(int i=0; i<2; i++) {
        for(int j=0; j<2; j++) {
            for(int k=0; k<2; k++) {
                for(int l=0; l<2; l++) {
                    (ans += dp[N][i][j][k][l][1][1]) %= MOD;
                }
            }
        }
    }
    cout << ans << endl;

    /*
    ll ans = dp[N][1][1][1][1][1][1];
    cerr << ans << endl;

    // x = L のとき
    {
        ll bit = (1LL << N) - 1;
        for(ll mask=bit; mask>0; mask=(mask-1)&bit) {
            if(mask < L or 2*L <= mask or R < mask) continue;
            if((mask & L) != L) continue;
            fprintf(stderr, "L = %lld, mask = %lld, mod = %lld, xor = %lld\n", L, mask, mask % L, mask ^ L);
            (ans += 1) %= MOD;
        }
    }

    // x = R のとき
    if(L != R) {
        ll bit = (1LL << N) - 1;
        for(ll mask=bit; mask>0; mask=(mask-1)&bit) {
            if(mask < R or 2*R <= mask or R < mask) continue;
            if((mask & R) != R) continue;
            fprintf(stderr, "R = %lld, mask = %lld, mod = %lld, xor = %lld\n", R, mask, mask % R, mask ^ R);
            (ans += 1) %= MOD;
        }
    }
    cout << ans << endl;
    */
    return 0;
}


Measured memory_bytes: 256