#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

long long int MOD = 1e9 + 7;
long long int print_bit = 10;

int main(){
  
  // read problem
  long long int l, r;
  scanf("%lld%lld", &l, &r);
  
  // exception case
  if(l == r){
    std::cerr << "exception case: L = R" << std::endl;
    std::cout << 1 << std::endl;
    return 0;
  }
  
  std::vector<long long int> L(61), R(61);
  for(long long int i = 0; i < 61; i++){
    L[i] = (l>>i)&1;
    R[i] = (r>>i)&1;
  }
  
  /*
  std::cerr << "original L: " << std::endl;
  for(long long int i = print_bit; i >= 0; i--){
    std::cerr << L[i] << " ";
  }std::cerr << std::endl;
  
  std::cerr << "original R: " << std::endl;
  for(long long int i = print_bit; i >= 0; i--){
    std::cerr << R[i] << " ";
  }std::cerr << std::endl;
   */
  
  // cut unnecessary part of R, L
  int cutflag = 0;
  for(long long int i = 60; i >= 0; i--){
    if(R[i] == 1 && L[i] == 0){
      break;
    }
    if(R[i] == 1 && L[i] == 1){
      R[i] = 0;
      L[i] = 0;
      cutflag = 1;
    }
  }
  /*
  std::cerr << "processed L: " << std::endl;
  for(long long int i = print_bit; i >= 0; i--){
    std::cerr << L[i] << " ";
  }std::cerr << std::endl;
  
  std::cerr << "processed R: " << std::endl;
  for(long long int i = print_bit; i >= 0; i--){
    std::cerr << R[i] << " ";
  }std::cerr << std::endl;
   */
  
  // solve problem
  std::vector<std::vector<long long int> > dp(61);
  
  for(long long int i = 0; i < 61; i++){
    for(long long int j = 0; j < 6; j++){
      dp[i].push_back(0);
    }
  }
  int lflag, rflag;
  lflag = 0;
  rflag = 0;
  
  for(long long int i = 59; i >= 0; i--){
      
    // determine initial bit
    if(cutflag == 0){
      if(rflag == 0 && R[i] == 1){
        rflag = 1;
        dp[i][0]++;
      }
      else if(rflag == 1 && lflag == 0 && L[i] == 0){
        dp[i][2]++;
      }
      else if(rflag == 1 && lflag == 0 && L[i] == 1){
        dp[i][4]++;
        lflag = 1;
      }
    }
    
   else if(cutflag == 1){
      if(rflag == 0 && R[i] == 1){
        rflag = 1;
        dp[i][0]++;
        dp[i][5]++;
        dp[i][4]++;
      }
    }
    
    // count recursion relation
    // determine dp[i][0], dp[i][4]
    dp[i][0] += dp[i+1][0];
    dp[i][4] += dp[i+1][4];
    // determine dp[i][5]
    if(R[i] >= L[i]){
      dp[i][5] += dp[i+1][5];
    }
    // determine dp[i][1]
    if(R[i] == 1) dp[i][1] += dp[i+1][1]*2 + dp[i+1][0];
    else dp[i][1] += dp[i+1][1];
    if(R[i] == 1 && L[i] == 0) dp[i][1] += dp[i+1][5];
    // determine dp[i][3]
    if(L[i] == 0) dp[i][3] += dp[i+1][3]*2 + dp[i+1][4];
    else dp[i][3] += dp[i+1][3];
    if(R[i] == 1 && L[i] == 0) dp[i][3] += dp[i+1][5];

    // determine dp[i][2]
    dp[i][2] += 3*dp[i+1][2];
    if(R[i] == 1) dp[i][2] += dp[i+1][0] + dp[i+1][1];
    if(L[i] == 0) dp[i][2] += dp[i+1][4] + dp[i+1][3];
    
    dp[i][1] = (dp[i][1] + MOD)%MOD;
    dp[i][2] = (dp[i][2] + MOD)%MOD;
    dp[i][3] = (dp[i][3] + MOD)%MOD;
  }
  /*
  std::cerr << "result of dp" << std::endl;
  for(long long int i = print_bit; i >= 0; i--){
    std::cerr << "i = " << i << " " << dp[i][0] << " " << dp[i][1] << " " << dp[i][2] << " " << dp[i][3] << " " << dp[i][4] << " " << dp[i][5] << std::endl;
  }std::cerr << std::endl;
   */
  // print answer
  long long int ans = 0;
  for(long long int i = 0; i < 6; i++){
    ans += dp[0][i];
    ans = (ans + MOD) % MOD;
  }
  std::cerr << "Answer:" << std::endl;
  std::cout << ans << std::endl;
  
  return 0;
}


Measured memory_bytes: 256