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

const int mod = 1000000007;
int sub(long l, long r, int k) {
  --r;
  long dp[2][2][64] = {};
  dp[1][1][k] = 1;
  for (int i = k - 1; i >= 0; --i) {
    for (int p : { 0, 1 }) {
      for (int q : { 0, 1 }) {
        for (int d : { 0, 1, 2 }) {
          int a = d >= 2;
          int b = d >= 1;
          int x = ((l >> i) & 1) - a;
          int y = b - ((r >> i) & 1);
          if (p == 1 && x == 1) continue;
          if (q == 1 && y == 1) continue;
          int np = p == 1 && x == 0;
          int nq = q == 1 && y == 0;
          dp[np][nq][i] += dp[p][q][i + 1];
          dp[np][nq][i] %= mod;
        }
      }
    }
  }
  
  long sum = 0;
  for (int p : { 0, 1 }) {
    for (int q : { 0, 1 }) {
      sum += dp[p][q][0];
      sum %= mod;
    }
  }
  return sum;
}

int main() {
  long l, r;
  cin >> l >> r;
  ++r;
  long sum = 0;
  for (int z = 0; z < 62; ++z) {
    long p = max(l, 1l << z);
    long q = min(r, 2l << z);
    if (p >= q) continue;
    sum = (sum + sub(p, q, z + 1)) % mod;
  }
  cout << sum << endl;
}
