#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.F << ":" << m.S << ") ";
  return os << "}";
}
long long sum(long long i) {
  if (i == 0) return 0;
  long long val = 0;
  long long odd_i = 1, even_i = 1;
  bool odd = 1;
  long long left = i;
  long long cur = 1;
  while (1) {
    if (left <= cur) {
      cur = left;
    }
    if (odd) {
      long long right = odd_i + cur - 1;
      long long lefts = odd_i - 1;
      long long a = (right - lefts) % 1000000007;
      long long b = (right + lefts) % 1000000007;
      val = (val + ((a) * (b)) % 1000000007) % 1000000007;
      odd_i = right + 1;
    } else {
      long long right = even_i + cur - 1;
      long long lefts = even_i - 1;
      long long x = (right) % 1000000007;
      long long a = (x * (x + 1)) % 1000000007;
      long long y = (lefts) % 1000000007;
      long long b = (y * (y + 1)) % 1000000007;
      val = (val + a - b) % 1000000007;
      even_i = right + 1;
    }
    left -= cur;
    if (left == 0) {
      break;
    }
    odd = 1 - odd;
    cur = cur + cur;
  }
  return val;
}
signed main() {
  long long l, r;
  cin >> l >> r;
  long long ans = (sum(r) - sum(l - 1)) % 1000000007;
  if (ans < 0) ans += 1000000007;
  cout << ans << endl;
}
