#include <bits/stdc++.h>

long long dp[61][2][2][2];// 桁数, L<=x 確定, x<=R 確定, 最上位bit確定
const long long mo = (long long) 1e9 + 7;

int main() {
  long long l, r;
  std::cin >> l >> r;
  for (int i = 0; i < 61; ++i)
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < 2; ++k)
	for (int s = 0; s < 2; ++s)
	  dp[i][j][k][s] = 0;
  dp[60][0][0][0] = 1;
  for (int i = 59; i >= 0; --i) {
    int lb = l >> i & 1;
    int ub = r >> i & 1;

    //pre-state
    for (int j = 0; j <= 1; ++j) {
      for (int k = 0; k <= 1; ++k) {
	for (int s = 0; s <= 1; ++s) {
	  if (dp[i + 1][j][k][s] == 0) continue;
	  // next x and y
	  for (int x = 0; x <= 1; ++x) {
	    for (int y = 0; y <= 1; ++y) {
	      if (x && !y) continue;
	      int nj = j, nk = k, ns = s;
	      if (!s && x != y) continue;
	      if (!j && lb && !x) continue;
	      if (!k && !ub && y) continue;
	      if (x && y) ns = 1;
	      if (!j && x && !lb) nj = 1;
	      if (!k && !y && ub) nk = 1;
	      dp[i][nj][nk][ns] += dp[i+1][j][k][s];
	      dp[i][nj][nk][ns] %= mo;
	    }
	  }
	}
      }
    }
  }
  long long ans = 0;
  for (int j = 0; j < 2; ++j)
    for (int k = 0; k < 2; ++k)
      for (int s = 0; s < 2; ++s)
      ans += dp[0][j][k][s];
  ans %= mo;
  std::cout << ans << std::endl;
}
