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

typedef long long ll;
const ll MOD = 1000000007ll;
const int N_DIGITS = 60;
ll L[N_DIGITS], R[N_DIGITS];
ll Dp[1 + N_DIGITS][2][2][2]; // これまでで L<x, y<R, x,y>0 が 不成立/成立
const bool Bs[2] = {false, true};

void go(ll &tgt, ll src) { (tgt += src) %= MOD; }
int main() {
  ll l, r;
  cin >> l >> r;
  for (int i = N_DIGITS - 1; i >= 0; --i) {
    L[i] = l % 2;
    R[i] = r % 2;
    l /= 2;
    r /= 2;
  }
  Dp[0][0][0][0] = 1;
  for (int i = 0; i < N_DIGITS; ++i) {
    for (bool overL : Bs) {
      for (bool underR : Bs) {
        for (bool some : Bs) {
          ll src = Dp[i][overL][underR][some];
          // 0,0
          if (overL || L[i] == 0) {
            go(Dp[i + 1][overL][underR || R[i] == 1][some], src);
          }
          // 0,1
          if ((overL || L[i] == 0) && (underR || R[i] == 1) && some) {
            go(Dp[i + 1][overL][underR][true], src);
          }
          // 1,1
          if (underR || R[i] == 1) {
            go(Dp[i + 1][overL || L[i] == 0][underR][true], src);
          }
        }
      }
    }
  }
  ll res = 0;
  for (bool overL : Bs) {
    for (bool underR : Bs) {
      for (bool some : Bs) {
        (res += Dp[N_DIGITS][overL][underR][some]) %= MOD;
      }
    }
  }
  cout << res << endl;
  return 0;
}
