#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    using mint = modint<mod>;

    ll L, R;
    cin >> L >> R;

    ll B = 64;
    vector<ll> LB(B), RB(B);
    REP(i, B){
        LB[i] = (L>>(B-1-i) & 1);
        RB[i] = (R>>(B-1-i) & 1);
    }

    //cout << LB << endl;
    //cout << RB << endl;

    mint dp[B+1][2][2][2];
    REP(i, B+1)REP(j, 2)REP(k, 2)REP(l, 2) dp[i][j][k][l] = 0;
    dp[0][1][1][0] = 1;

    REP(i, B){
        REP(tight1, 2){
            REP(tight2, 2){
                REP(aru, 2){
                    ll d1e = (tight1 ? RB[i] : 1);
                    ll d2s = (tight2 ? LB[i] : 0);
                    for(int d1=0;d1<=d1e;d1++){
                        for(int d2=d2s;d2<=1;d2++){
                            if(d1 == 0 and d2 == 1) continue;
                            if(aru == 0 and d1 == 1 and d2 == 0) continue;
                            ll nex1, nex2, naru;

                            if(tight1 == 1 and d1 == RB[i]) nex1 = 1;
                            else nex1 = 0;

                            if(tight2 == 1 and d2 == LB[i]) nex2 = 1;
                            else nex2 = 0;

                            if((d1 == 1 and d2 == 1) or aru==1) naru = 1;
                            else naru = 0;

                            dp[i+1][nex1][nex2][naru] += dp[i][tight1][tight2][aru];
                        }
                    }
                }
            }
        }
    }

    mint res = 0;
    REP(i, 2)REP(j, 2)REP(k, 2) res += dp[B][i][j][k];
    cout << res.value() << endl;
    return 0;
}

Measured memory_bytes: 256