#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll iL, iR;
mint dp[70][2][2][3];

std::string bin( ll x ) {
  std::string ret;
  ll cnt = 0;

  while( x > 0 ) {
    ret += (x&1)+'0';
    x >>= 1;
    ++cnt;
  }

  rep( i, 60ll-cnt )
    ret += '0';

  std::reverse( all(ret) );

  return ret;
}

int main() {
  std::cin >> iL >> iR;

  std::string L = bin(iL);
  std::string R = bin(iR);

  //std::cout << L << ' ' << R << std::endl;

  dp[0][0][0][0] = 1;

  rep( i, 60 ) rep( larger, 2 ) rep( smaller, 2 ) rep( fl, 3 ) {
    rep( d1, 2 ) rep( d2, 2 ) {
      if( d1 < d2 )
        continue;
      if( !larger && d2 < L[i]-'0' )
        continue;
      if( !smaller && d1 > R[i]-'0' )
        continue;

      int nfl = 0;

      if( fl == 1 )
        nfl = 1;
      else if( !fl && d1 == d2 && d1 == 1 )
        nfl = 1;
      else if( !fl && d1 == d2 && !d1 )
        nfl = 0;
      else
        nfl = 2;

      //if( dp[i][larger][smaller][fl].x )
        //printf( "dp[%lld][%lld][%lld][%lld] += dp[%lld][%lld][%lld][%lld] (%lld) (%lld,%lld) (%lld,%lld)\n", i+1, larger || d2 > L[i]-'0', smaller || d1 < R[i]-'0', nfl, i, larger, smaller, fl, dp[i][larger][smaller][fl], d1, d2, L[i]-'0', R[i]-'0' );

      dp[i+1][larger || d2 > L[i]-'0'][smaller || d1 < R[i]-'0'][nfl] += dp[i][larger][smaller][fl];
    }
  }

  mint ans = 0;

  rep( larger, 2 ) rep( smaller, 2 )
    ans += dp[60][larger][smaller][1];

  std::cout << ans.x << std::endl;

  return 0;
}

Measured memory_bytes: 256