#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i >= a; i--)
#define pb push_back

const ll mod = 1e9+7;
ll lo,hi;

ll ans = 0;

const int m = 62;

// dp[i][yet][y > lo][y < hi][x > lo][x < hi]
ll dp[m][2][2][2][2][2];

void add(ll &a, ll b) {
  a += b;
  if (a>=mod) a-=mod;
}

void prop(int i, int yet, int ylo, int yhi, int xlo, int xhi) {
  f(y,ylo?0:(lo>>i&1),(yhi?1:(hi>>i&1))+1)
  f(x,xlo?0:(lo>>i&1),(xhi?1:(hi>>i&1))+1) {
    if ( x<=y && (yet||(x==y))) {
  	if (!i) add(ans,dp[i][yet][ylo][yhi][xlo][xhi]);
    else add(dp[i-1][yet|x][ylo|(y!=(lo>>i&1))][yhi|(y!=(hi>>i&1))]
             [xlo|(x!=(lo>>i&1))][xhi|(x!=(hi>>i&1))], dp[i][yet][ylo][yhi][xlo][xhi]);
    }
  }
}

int main() {
  cin>>lo>>hi;
  f(i,0,m) f(yet,0,2) f(ylo,0,2) f(yhi,0,2) f(xlo,0,2) f(xhi,0,2) 
    dp[i][yet][ylo][yhi][xlo][xhi] = 0;
  dp[m-1][0][0][0][0][0] = 1;
  fr(i,0,m) f(yet,0,2) f(ylo,0,2) f(yhi,0,2) f(xlo,0,2) f(xhi,0,2) 
    if (dp[i][yet][ylo][yhi][xlo][xhi])
    	prop(i,yet,ylo,yhi,xlo,xhi);
  cout << ans << endl;
  return 0;
}