#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#ifdef MUTABLE
int mod;
#else
template<int mod>
#endif
struct ModInt {
  int val;
  ModInt inv() const{
    int tmp,a=val,b=mod,x=1,y=0;
    while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
    return ModInt(x);
  }
  ModInt():val(0){}
  ModInt(ll x){if((val=x%mod)<0)val+=mod;}
  ModInt pow(ll t){ModInt res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
  ModInt& operator+=(const ModInt& x){if((val+=x.val)>=mod)val-=mod;return *this;}
  ModInt& operator-=(const ModInt& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
  ModInt& operator*=(const ModInt& x){val=(ll)val*x.val%mod; return *this;}
  ModInt& operator/=(const ModInt& x){return *this*=x.inv();}
  bool operator==(const ModInt& x) const{return val==x.val;}
  bool operator!=(const ModInt& x) const{return val!=x.val;}
  bool operator<(const ModInt& x) const{return val<x.val;}
  bool operator<=(const ModInt& x) const{return val<=x.val;}
  bool operator>(const ModInt& x) const{return val>x.val;}
  bool operator>=(const ModInt& x) const{return val>=x.val;}
  ModInt operator+(const ModInt& x) const{return ModInt(*this)+=x;}
  ModInt operator-(const ModInt& x) const{return ModInt(*this)-=x;}
  ModInt operator*(const ModInt& x) const{return ModInt(*this)*=x;}
  ModInt operator/(const ModInt& x) const{return ModInt(*this)/=x;}
  static int get_mod() { return mod; }
};

#ifndef MUTABLE
using modint = ModInt<1000000007>;
#endif

modint dp[61][2][2][2]; // dp[下からi桁目][xがlより大きいか][yがrより小さいか][(1,1)が登場したか]

int main() {
  // l <= x <= y <=r, x == x&yとなる(x,y)の個数を求める
  // 桁dpでいい感じに求められそう?
  ll l, r; cin >> l >> r;
  // cerr << l << " " << r << endl;
  dp[60][0][0][0] = 1;
  for (int i = 60; i > 0; --i) {
    int dl = (l >> (i-1)) & 1;
    int dr = (r >> (i-1)) & 1;
    for (int dx = 0; dx < 2; ++dx) {
      for (int dy = 0; dy < 2; ++dy) {
        if (dx == 1 && dy == 0) continue;
        // (1, 1, 1)
        {
          int nl = 1, nr = 1, nc = 1;
          dp[i-1][nl][nr][nc] += dp[i][1][1][1];
        }
        // (1, 1, 0)
        if (dx != 0 || dy != 1) {
          int nl = 1, nr = 1, nc = 0;
          if (dx == 1 && dy == 1) nc = 1;
          dp[i-1][nl][nr][nc] += dp[i][1][1][0];
        }
        // (1, 0, 1)
        if (dy <= dr) {
          int nl = 1, nr = 0, nc = 1;
          if (dy < dr) nr = 1;
          dp[i-1][nl][nr][nc] += dp[i][1][0][1];
        }
        // (1, 0, 0)
        if ((dx != 0 || dy != 1) && dy <= dr) {
          int nl = 1, nr = 0, nc = 0;
          if (dy < dr) nr = 1;
          if (dx == 1 && dy == 1) nc = 1;
          dp[i-1][nl][nr][nc] += dp[i][1][0][0];
        }
        // (0, 1, 1)
        if (dx >= dl) {
          int nl = 0, nr = 1, nc = 1;
          if (dx > dl) nl = 1;
          dp[i-1][nl][nr][nc] += dp[i][0][1][1];
        }
        // (0, 1, 0)
        if ((dx != 0 || dy != 1) && dx >= dl) {
          int nl = 0, nr = 1, nc = 0;
          if (dx > dl) nl = 1;
          if (dx == 1 && dy == 1) nc = 1;
          dp[i-1][nl][nr][nc] += dp[i][0][1][0];
        }
        // (0, 0, 1)
        if (dx >= dl && dy <= dr) {
          int nl = 0, nr = 0, nc = 1;
          if (dx > dl) nl = 1;
          if (dy < dr) nr = 1;
          dp[i-1][nl][nr][nc] += dp[i][0][0][1];
        }
        // (0, 0, 0)
        if ((dx != 0 || dy != 1) && dx >= dl && dy <= dr) {
          int nl = 0, nr = 0, nc = 0;
          if (dx > dl) nl = 1;
          if (dy < dr) nr = 1;
          if (dx == 1 && dy == 1) nc = 1;
          dp[i-1][nl][nr][nc] += dp[i][0][0][0];
        }
      }
    }
    // cerr << dl << " " << dr << endl;
  }
  modint ans = 0;
  for (int l = 0; l < 2; ++l) { 
    for (int r = 0; r < 2; ++r) { 
      for (int c = 0; c < 2; ++c) { 
        ans += dp[0][l][r][c];
      }
    }
  }
  cout << ans.val << endl;
}


Measured memory_bytes: 256