#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1005;
long long L, R;
long long a[N], b[N];
long long dp[70][2][2][2];
long long calc(long long pos, bool is_l, bool is_r, bool ch = 0) {
  if (pos < 0) return !is_l or !is_r;
  if (dp[pos][is_l][is_r][ch] != -1) return dp[pos][is_l][is_r][ch];
  long long &res = dp[pos][is_l][is_r][ch];
  res = 0;
  if (!is_r or b[pos]) (res += calc(pos - 1, is_l && a[pos], is_r, 1)) %= mod;
  if ((!is_r or b[pos]) and (!is_l or !a[pos]) and ch)
    (res += calc(pos - 1, is_l && !a[pos], is_r, 1)) %= mod;
  if (!is_l or !a[pos])
    (res += calc(pos - 1, is_l && !a[pos], is_r and !b[pos], ch)) %= mod;
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> L >> R;
  for (int i = 61; i >= 0; --i) {
    a[i] = (L >> i) & 1;
    b[i] = (R >> i) & 1;
  }
  memset(dp, -1, sizeof dp);
  cout << calc(60, 1, 1);
  return 0;
}
