#include <bits/stdc++.h>
using namespace std;
long long geteven(long long l, long long r) {
  if (l > r) return 0;
  return ((r % 1000000007LL) * ((r + 1) % 1000000007LL) % 1000000007LL -
          (l % 1000000007LL) * ((l - 1) % 1000000007LL) % 1000000007LL +
          1000000007LL) %
         1000000007LL;
}
long long getodd(long long l, long long r) {
  if (l > r) return 0;
  return ((r % 1000000007LL) * (r % 1000000007LL) % 1000000007LL -
          ((l - 1) % 1000000007LL) * ((l - 1) % 1000000007LL) % 1000000007LL +
          1000000007LL) %
         1000000007LL;
}
long long l, r;
vector<long long> v;
long long get(long long n) {
  long long cur1 = 0, cur2 = 0, cur = 0, ans = 0;
  for (long long i = 0; i < (long long)v.size(); i++) {
    if (i % 2 == 0) {
      long long del = min(v[i], n - cur);
      ans = (ans + getodd(cur1 + 1, cur1 + del)) % 1000000007LL;
      cur1 += del;
      cur += del;
    } else {
      long long del = min(v[i], n - cur);
      ans = (ans + geteven(cur2 + 1, cur2 + del)) % 1000000007LL;
      cur2 += del;
      cur += del;
    }
    if (cur >= n) return ans;
  }
  return ans;
}
void solve() {
  cin >> l >> r;
  long long cur = 1;
  while (cur <= 1e18) {
    v.push_back(cur);
    cur *= 2;
  }
  cout << (get(r) - get(l - 1) + 1000000007LL) % 1000000007LL << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
