#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
template<int MOD> class Modular {
private:
  long long value;
public:
  constexpr Modular() : value() {};
  constexpr Modular(const Modular& other) : value(other.value) {}
  template <typename U> constexpr Modular(const U& x) { value = normalize(x); }

  template <typename U> static long long normalize(const U& x) {
    long long v;
    if (-MOD <= x && x < MOD) v = static_cast<long long>(x);
    else v = static_cast<long long>(x % MOD);
    if (v < 0) v += MOD;
    return v;
  }

  constexpr long long inverse(long long x) {
    x = (x % MOD + MOD) % MOD;
    long long y = MOD, u = 1, v = 0;
    while(y) {
      long long t = x / y;
      x -= t * y; swap(x, y);
      u -= t * v; swap(u, v);
    }
    return (u % MOD + MOD) % MOD;
  }

  explicit operator long long() const noexcept { return value;}
 	template <typename U> explicit operator U() const noexcept { return static_cast<U>(value); }

  constexpr Modular& operator=(const Modular& other) & noexcept { value = other.value; return *this; }
  template <typename U> constexpr Modular& operator=(const U& other) & noexcept { return *this = Modular(other); }

  constexpr Modular& operator+=(const Modular& other) noexcept { if ((value += other.value) >= MOD) value -= MOD; return *this; }
  template <typename U> constexpr Modular& operator+=(const U& other) noexcept { return *this += Modular(other); }

  constexpr Modular& operator-=(const Modular& other) noexcept { if ((value -= other.value) < 0) value += MOD; return *this; }
  template <typename U> constexpr Modular& operator-=(const U& other) noexcept { return *this -= Modular(other); }

  constexpr Modular& operator*=(const Modular& other) noexcept { value = value * other.value % MOD; return *this; }
  template <typename U> constexpr Modular& operator*=(const U& other) noexcept {return *this *= Modular(other); }

  constexpr Modular& operator/=(const Modular& other) noexcept { return *this *= Modular(inverse(other.value)); }
  template <typename U> constexpr Modular& operator/=(const U& other) noexcept { return *this *= Modular(inverse(normalize(other))); }

  constexpr Modular& operator++() noexcept {return *this += 1; }
  constexpr Modular operator++(int) noexcept { Modular ret(*this); *this += 1; return ret; }

  constexpr Modular& operator--() noexcept {return *this -= 1; }
  constexpr Modular operator--(int) noexcept { Modular ret(*this); *this += 1; return ret; }

  constexpr Modular operator-() const { return Modular(-value); }

  friend constexpr bool operator==(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return lhs.value == rhs.value; }
  template <typename U> friend constexpr bool operator==(const Modular<MOD>& lhs, U rhs) noexcept { return lhs == Modular<MOD>(rhs); }
  template <typename U> friend constexpr bool operator==(U lhs, const Modular<MOD>& rhs) noexcept { return Modular<MOD>(lhs) == rhs; }

  friend constexpr bool operator!=(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return !(lhs == rhs); }
  template <typename U> friend constexpr bool operator!=(const Modular<MOD>& lhs, U rhs) noexcept { return !(lhs == rhs); }
  template <typename U> friend constexpr bool operator!=(U lhs, const Modular<MOD> rhs) noexcept { return !(lhs == rhs); }

  friend constexpr bool operator<(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return lhs.value < rhs.value; }
  template <typename U> friend constexpr bool operator<(const Modular<MOD> &lhs, U rhs) noexcept { return lhs.value < rhs; }
  template <typename U> friend constexpr bool operator<(U lhs, const Modular<MOD> &rhs) noexcept { return lhs < rhs.value; }

  friend constexpr bool operator>(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return rhs.value < lhs.value; }
  template <typename U> friend constexpr bool operator>(const Modular<MOD> &lhs, U rhs) noexcept { return rhs.value < lhs; }
  template <typename U> friend constexpr bool operator>(U lhs, const Modular<MOD> &rhs) noexcept { return rhs < lhs.value; }

  friend constexpr bool operator<=(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return !(lhs.value > rhs.value); }
  template <typename U> friend constexpr bool operator<=(const Modular<MOD> &lhs, U rhs) noexcept { return !(lhs.value > rhs); }
  template <typename U> friend constexpr bool operator<=(U lhs, const Modular<MOD> &rhs) noexcept { return !(lhs < rhs.value); }

  friend constexpr bool operator>=(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return !(lhs.value < rhs.value); }
  template <typename U> friend constexpr bool operator>=(const Modular<MOD> &lhs, U rhs) noexcept { return !(lhs.value < rhs); }
  template <typename U> friend constexpr bool operator>=(U lhs, const Modular<MOD> &rhs) noexcept { return !(lhs < rhs.value); }

  friend constexpr Modular<MOD> operator+(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return Modular<MOD>(lhs) += rhs; }
  template <typename U> friend constexpr Modular<MOD> operator+(const Modular<MOD>& lhs, U rhs) noexcept { return Modular<MOD>(lhs) += rhs; }
  template <typename U> friend constexpr Modular<MOD> operator+(U lhs, const Modular<MOD> &rhs) noexcept { return Modular<MOD>(lhs) += rhs; }

  friend constexpr Modular<MOD> operator-(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return Modular<MOD>(lhs) -= rhs; }
  template <typename U> friend constexpr Modular<MOD> operator-(const Modular<MOD>& lhs, U rhs) noexcept { return Modular<MOD>(lhs) -= rhs; }
  template <typename U> friend constexpr Modular<MOD> operator-(U lhs, const Modular<MOD> &rhs) noexcept { return Modular<MOD>(lhs) -= rhs; }

  friend constexpr Modular<MOD> operator*(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return Modular<MOD>(lhs) *= rhs; }
  template <typename U> friend constexpr Modular<MOD> operator*(const Modular<MOD>& lhs, U rhs) noexcept { return Modular<MOD>(lhs) *= rhs; }
  template <typename U> friend constexpr Modular<MOD> operator*(U lhs, const Modular<MOD> &rhs) noexcept { return Modular<MOD>(lhs) *= rhs; }

  friend constexpr Modular<MOD> operator/(const Modular<MOD>& lhs, const Modular<MOD>& rhs) noexcept { return Modular<MOD>(lhs) /= rhs; }
  template <typename U> friend constexpr Modular<MOD> operator/(const Modular<MOD>& lhs, U rhs) noexcept { return Modular<MOD>(lhs) /= rhs; }
  template <typename U> friend constexpr Modular<MOD> operator/(U lhs, const Modular<MOD> &rhs) noexcept { return Modular<MOD>(lhs) /= rhs; }

  friend std::ostream& operator<<(std::ostream& stream, const Modular<MOD>& number) noexcept { return stream << number.value; }
  friend std::istream& operator>>(std::istream& stream, Modular<MOD>& number) { long long in; stream >> in; number.value = Modular<MOD>::normalize(in); return stream; }
  
  constexpr int getmod() const { return MOD; }
};

template<int MOD, typename U> Modular<MOD> power(const Modular<MOD>& x, const U& y) {
  assert(y >= 0);
  Modular<MOD> k = x, result = 1;
  U p = y;
  while (p > 0) {
    if (p & 1) result *= k;
    k *= k;
    p >>= 1;
  }
  return result;
}

template<int MOD> class BinaryCoefficients {
private:
  vector<Modular<MOD>> fact_, inv_, finv_;
public:
  constexpr BinaryCoefficients(int n = 2020200) : fact_(n, 1), inv_(n, 1), finv_(n, 1) {
    for (int i = 2; i < n; i++) {
      fact_[i] = fact_[i - 1] * i;
      inv_[i] = -inv_[MOD % i] * (MOD / i);
      finv_[i] = finv_[i - 1] * inv_[i];
    }
  }
  constexpr Modular<MOD> comb(int n, int k) const noexcept { if (n < k || n < 0 || k < 0) return 0; return fact_[n] * finv_[k] * finv_[n - k]; }
  constexpr Modular<MOD> fact(int n) const noexcept { if (n < 0) return 0; return fact_[n]; }
  constexpr Modular<MOD> inv(int n) const noexcept { if (n < 0) return 0; return inv_[n]; }
  constexpr Modular<MOD> finv(int n) const noexcept { if (n < 0) return 0; return finv_[n]; }
};

constexpr int mod = 1e9 + 7;
//constexpr int mod = 998244353;
using mint = Modular<mod>;
using bicoef = BinaryCoefficients<mod>;

const int n = 61;
mint dp[n + 100][2][2][2];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  long long l, r;
  cin >> l >> r;
  bitset<n> bi_l(l), bi_r(r);
  dp[n][0][0][0] = 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int mt_l = 0; mt_l < 2; mt_l++) for (int lt_r = 0; lt_r < 2; lt_r++) for (int st = 0; st < 2; st++) {
      for (int bx = 0; bx < 2; bx++) for (int by = 0; by < 2; by++) {
        if (bx == 1 && by == 0) continue;
        if (mt_l == 0 && bi_l[i] > bx) continue;
        if (lt_r == 0 && bi_r[i] < by) continue;
        if (st == 0 && (bx ^ by)) continue;
        dp[i][mt_l | (bi_l[i] < bx)][lt_r | (bi_r[i] > by)][st || (bx && by)] += dp[i + 1][mt_l][lt_r][st];
      }
    }
  }
  mint ans = 0;
  for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) for (int k = 0; k < 2; k++) {
    ans += dp[0][i][j][k];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256