#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

constexpr int64 P = 1000000007;

struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 x) : x(x) {
    if (x > P || x < 0) { cerr << "Invalied FiniteField!" << endl; exit(1); }
  }
  FiniteField() : x(0) {}
  int64 Value() const { return x; }
  inline FiniteField operator+(FiniteField o) const {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) const {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) const {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) const {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

constexpr int NUM_BITS = 60;

template<typename T>
vector<vector<vector<vector<T>>>>
Make4DVector(int d1, int d2, int d3, int d4, T default_value) {
  return vector<vector<vector<vector<T>>>>(
      d1,
      vector<vector<vector<T>>>(
          d2, vector<vector<T>>(d3, vector<T>(d4, default_value))));
}

constexpr int DEBUG = 0;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int64 l, r;
  cin >> l >> r;

  // (bit, >= L, <= R, has head)
  auto dp = Make4DVector<FiniteField>(NUM_BITS + 1, 2, 2, 2, 0);
  // The 60-th bit is always zero.
  dp[NUM_BITS][0][0][0] = 1;
  for (int b = NUM_BITS - 1; b >= 0; b--) {
    int l_bit = (l >> b) & 1;
    int r_bit = (r >> b) & 1;
    for (int l_flag = 0; l_flag < 2; l_flag++) {
      for (int r_flag = 0; r_flag < 2; r_flag++) {
        for (int h_flag = 0; h_flag < 2; h_flag++) {
          auto prev = dp[b + 1][l_flag][r_flag][h_flag];
          for (int x_bit = 0; x_bit < 2; x_bit++) {
            for (int y_bit = 0; y_bit < 2; y_bit++) {
              if (x_bit && !y_bit) continue;
              if (!l_flag && x_bit < l_bit) continue;
              if (!r_flag && y_bit > r_bit) continue;
              if (!h_flag && (!x_bit && y_bit)) continue;

              int next_l_flag = l_flag | (x_bit > l_bit);
              int next_r_flag = r_flag | (y_bit < r_bit);
              int next_h_flag = h_flag | (x_bit && y_bit);

              if (DEBUG) {
                cout << "l_flag: " << l_flag << " r_flag: " << r_flag
                     << " h_flag: " << h_flag << endl;
                cout << "x_bit: " << x_bit << " y_bit: " << y_bit << endl;
                cout << "next_l_flag: " << next_l_flag
                     << " next_r_flag: " << next_r_flag
                     << " next_h_flag: " << next_h_flag << endl;
              }
              dp[b][next_l_flag][next_r_flag][next_h_flag] += prev;
            }
          }
        }
      }
    }
  }

  FiniteField ans = 0;
  for (int l_flag = 0; l_flag < 2; l_flag++) {
    for (int r_flag = 0; r_flag < 2; r_flag++) {
      for (int h_flag = 0; h_flag < 2; h_flag++) {
        ans += dp[0][l_flag][r_flag][h_flag];
      }
    }
  }
  cout << ans.Value() << endl;
}

Measured memory_bytes: 256