#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


// 剰余演算クラス
struct ModInt{
    static const LL MOD = 1e+9 + 7;
    LL v;
    ModInt():v(0){}
    ModInt(LL op):v(op){}
    ModInt operator+(ModInt op) const{ return (v + op) % MOD; }
    ModInt operator-(ModInt op) const{ return (v - op + MOD) % MOD; }
    ModInt operator*(ModInt op) const{ return (v * op) % MOD; }
    ModInt operator/(ModInt op) const{ return (v * op.inverse()) % MOD; }
    ModInt operator%(LL op) = delete;
    ModInt operator+=(ModInt op){ return v = (v + op) % MOD; }
    ModInt operator-=(ModInt op){ return v = (v - op + MOD) % MOD; }
    ModInt operator*=(ModInt op){ return v = (v * op) % MOD; }
    ModInt operator/=(ModInt op){ return v = (v * op.inverse()) % MOD; }
    ModInt operator-() const{ return MOD - v; }
    bool operator==(ModInt op) const{ return v == op.v; }
    bool operator!=(ModInt op) const{ return v != op.v; }
    ModInt inverse() const{ return pow(MOD-2); }
    ModInt pow(LL n) const{
        if(n < 0) return pow(MOD-1 + n);
        if(n == 0) return 1;
        ModInt res = pow(n/2);
        return res * res * ((n&1)?ModInt(v): ModInt(1));
    }
    LL get() const{ return v; }
private:
    operator LL() const{ return v; }
};
istream& operator>>(istream& st, ModInt& m){ st>>m.v; return st; }
ostream& operator<<(ostream& st, const ModInt& m){ st<<m.v; return st; }

vector<ModInt> factorial(LL n){
    vector<ModInt> res(n, 1);
    for(LL i = 2; i < n; ++i) res[i] = res[i-1] * ModInt(i);
    return res;
}

ModInt permutation(LL n, LL m, vector<ModInt>& factorial){
    if(m < 0 || n < m) return 0;
    if(m == 0) return 1;
    return factorial.at(n) / factorial.at(n-m);
}

ModInt combination(LL n, LL m, vector<ModInt>& factorial){
    if(m < 0 || n < m) return 0;
    if(m == 0) return 1;
    return factorial.at(n) / factorial.at(n-m) / factorial.at(m);
}


ModInt solve(LL pos, LL y_less_r, LL x_greater_l, LL x_start, vector<vector<LL>>& memo, LL l, LL r){
    if(pos < 0) return ModInt(1);
    if(memo[y_less_r*4 + x_greater_l*2 + x_start][pos] >= 0){
        return ModInt(memo[y_less_r*4 + x_greater_l*2 + x_start][pos]);
    }
    LL l_bit = (l >> pos) & 1;
    LL r_bit = (r >> pos) & 1;
    ModInt ans = 0;

    // x:0 y:0
    if(x_greater_l || l_bit == 0){ // x:0
        if(true){ // y:0
            LL y_less_r_next = y_less_r | ((r_bit==1)?1:0);
            ans += solve(pos-1, y_less_r_next, x_greater_l, x_start, memo, l, r);
        }
    }
    // x:0 y:1
    if(x_greater_l || l_bit == 0){ // x:0
        if(x_start && (y_less_r==1 || r_bit == 1)){ // y:1
            ans += solve(pos-1, y_less_r, x_greater_l, x_start, memo, l, r);
        }
    }
    // x:1 y:1
    if(true){ // x:1
        if(y_less_r==1 || r_bit == 1){ // y:1
            LL x_greater_l_next = x_greater_l | ((l_bit==0)?1:0);
            ans += solve(pos-1, y_less_r, x_greater_l_next, 1, memo, l, r);
        }
    }
    memo[y_less_r*4 + x_greater_l*2 + x_start][pos] = ans.get();
    return ans;
}

int main(){
    LL l, r;
    cin >> l >> r;
    vector<vector<LL>> memo(8, vector<LL>(61, -1));
    cout << solve(60, 0, 0, 0, memo, l, r) << endl;
    return 0;
}



Measured memory_bytes: 256