#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>

using std::vector;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}
constexpr long long MOD = 1000000007;

int main() {
    //std::ifstream in("in01.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    long long l, r;
    std::cin >> l >> r;
    
    //x = sum_i=0^MSB(x) xb(i) * (1 << i)
    //y = sum_i=0^MSB(y) yb(i) * (1 << i)
    
    //y^x = sum_i=0^MSB(y) ((yb(i)+xb(i)) % 2) * (1 << i) = sum_i=0^MSB(y) ((yb(i)-xb(i)) % 2) * (1 << i)
    //y%x < x = sum_i=0^MSB(x) xb(i) * (1 << i)
    
    //y%x = y^x => MSB(y) = MSB(x) = d
    //y%x = y^x => y%x = y-x = y^x
    //y%x = y^x => yb(i) >= xb(i)
    
    //桁dp dp[i][el][er][msbf]上からi桁目で、l,rとx,yが一致しているか否か、msbはすでに立っているか、における暫定組み合わせ数
    vector<vector<vector<vector<long long>>>> dp;
    ndarray(dp, 64, 2, 2, 2);
    int msbr;
    for (msbr = 63; msbr >=0; msbr--) {
        if (((r >> msbr) & 1) == 1) break;
    }
    int msbl;
    for (msbl = 63; msbl >=0; msbl--) {
        if (((l >> msbl) & 1) == 1) break;
    }
    dp[msbr+1][1][1][0] = 1;
    for (int d = msbr+1; d > 0; d--) {
        int lnb = (l >> (d-1)) & 1;
        int rnb = (r >> (d-1)) & 1;
        
        for (int el = 0; el < 2; el++) {
            for (int er = 0; er < 2; er++) {
                for (int ynb = 0; ynb < 2; ynb++) {
                    for (int xnb = 0; xnb < 2; xnb++) {
                        for (int msbf = 0; msbf < 2; msbf++) {
                            int eln, ern, msbfn = 1;
                            if (msbf == 0) {
                                if (ynb != xnb) continue;//msbが異なる
                                if (ynb != 1) msbfn = 0;
                            }
                            if (ynb < xnb) continue; //繰り下がりあり
                            if (el == 1) {
                                if (xnb < lnb) {
                                    continue; //x < L
                                }
                                if (xnb == lnb) {
                                    eln = 1;
                                } else {
                                    eln = 0;
                                }
                            } else {
                                eln = 0;
                            }
                            if (er == 1) {
                                if (ynb > rnb) {
                                    continue; // y > R
                                }
                                if (ynb == rnb) {
                                    ern = 1;
                                } else {
                                    ern = 0;
                                }
                            } else  {
                                ern = 0;
                            }
                            
                            dp[d-1][eln][ern][msbfn] += dp[d][el][er][msbf];
                            dp[d-1][eln][ern][msbfn] %= MOD;
                        }
                    }
                }
            }
        }
        //std::cout << (dp[d][0][0][1] + dp[d][1][0][1] + dp[d][0][1][1] + dp[d][1][1][1]) % MOD << std::endl;
    }
    std::cout << (dp[0][0][0][1] + dp[0][1][0][1] + dp[0][0][1][1] + dp[0][1][1][1]) % MOD << std::endl;
    return 0;
}


Measured memory_bytes: 256