#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  long long solve(long long l, long long r) {
    const long long MOD = 1000000007;
    int n = 0;
    while (1LL << (n + 1) <= r) {
      ++n;
    }
    int m = 2;
    int M = 1 << m;
    vector<vector<long long>> dp(M, vector<long long>(M, 0));
    vector<vector<long long>> ndp(dp);
    for (int i = n; i >= 0; --i) {
      int a = (l >> i) & 0x1;
      int b = (r >> i) & 0x1;
      for (auto& V : ndp) {
        for (auto& x : V) {
          x = 0;
        }
      }
      for (int j = 0; j < M; ++j) {
        int xl = 0, xr = 1;
        if ((j & 1) == 0) {
          xl = max(xl, a);
        }
        if ((j & 2) == 0) {
          xr = min(xr, b);
        }
        for (int k = 0; k < M; ++k) {
          int yl = 0, yr = 1;
          if ((k & 1) == 0) {
            yl = max(yl, a);
          }
          if ((k & 2) == 0) {
            yr = min(yr, b);
          }
          for (int x = xl; x <= xr; ++x) {
            for (int y = yl; y <= yr; ++y) {
              if (x == 1 && y == 0) {
                continue;
              }
              int nj = j;
              int nk = k;
              if (x > a) {
                nj |= 1;
              }
              if (x < b) {
                nj |= 2;
              }
              if (y > a) {
                nk |= 1;
              }
              if (y < b) {
                nk |= 2;
              }
              (ndp[nj][nk] += dp[j][k]) %= MOD;
            }
          }
        }
      }
      swap(ndp, dp);
      {
        long long L = l & ~((1LL << i) - 1);
        long long R = r & ~((1LL << i) - 1);
        if ((1LL << i) >= L) {
          int nj = 0;
          if ((1LL << i) > L) {
            nj |= 1;
          }
          if ((1LL << i) < R) {
            nj |= 2;
          }
          (dp[nj][nj] += 1) %= MOD;
        }
      }
    }
    long long res = 0;
    for (int i = 0; i < M; ++i) {
      for (int j = 0; j < M; ++j) {
        res += dp[i][j];
      }
    }
    res %= MOD;
    return res;
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long l, r;
  cin >> l >> r;
  Solution sol;
  cout << sol.solve(l, r) << "\n";
  return 0;
}
