#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(int i=(ll)(b);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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 (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


class runtime_modint {
  using u64 = std::uint_fast64_t;

  static u64 &mod() {
    static u64 mod_ = 0;
    return mod_;
  }

public:
  u64 a;

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

  runtime_modint pow(unsigned long n){
    runtime_modint res(1),a=*this;
    while(n){
      if(n%2){
        res*=a;
      }
      a*=a;
      n/=2;
    }
    return res;
  }


  static void set_mod(const u64 x) { mod() = x; }
  static u64 get_mod() { return mod(); }
};
using mint=runtime_modint;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  using bs=bitset<63>;
  mint::set_mod(1e9+7);
  ll tl,tr;cin>>tl>>tr;
  bs l=tl,r=tr;
  ll ln=63,rn=63;
  vector<mint>dp(4),tdp(4);
  rrep(k,63){
    if(r[k]){rn=k+1;break;}
  }
  rrep(k,63){
    if(l[k]){ln=k+1;break;}
  }
  rrep(k,rn){
    tdp.assign(4,0);
    //配る
    tdp[3]+=dp[3]*3;

    if(r[k]){
      tdp[2]+=dp[2]*2;
      tdp[3]+=dp[2];
    }
    else {
      tdp[2]+=dp[2];
    }

    if(l[k]){
      tdp[1]+=dp[1];
    }
    else {
      tdp[1]+=dp[1]*2;
      tdp[3]+=dp[1];
    }

    if(l[k]==1&&r[k]==0){
    }
    else {
      tdp[0]+=dp[0];
      if(l[k]<r[k]){
        tdp[1]+=dp[0];
        tdp[2]+=dp[0];
      }
    }

    if(k>=ln-1){
      if(k==rn-1&&k==ln-1){
        tdp[0]+=1;
      }
      if(k==rn-1&&k>ln-1){
        tdp[2]+=1;
      }
      if(k<rn-1&&k==ln-1){
        tdp[1]+=1;
      }
      if(k<rn-1&&k>ln-1){
        tdp[3]+=1;
      }
    }
    swap(dp,tdp);
  }
  mint res;
  rep(i,4)res+=dp[i];
  cout<<res.value()<<endl;

  return 0;

}


Measured memory_bytes: 256