#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
long long getSum(long long n, long long a, long long p) {
  return (n * (((a + p) / 2) % mod)) % mod;
}
long long solve(long long n) {
  long long a = 0;
  long long odd = 0;
  long long even = 0;
  for (int i = 0;; i++) {
    if ((1LL << i) <= n) {
      if (i & 1)
        even += (1LL << i);
      else
        odd += (1LL << i);
      n -= (1LL << i);
    } else {
      if (i & 1)
        even += n;
      else
        odd += n;
      break;
    }
  }
  return (getSum(odd % mod, 1, odd * 2 - 1) + getSum(even % mod, 2, 2 * even)) %
         mod;
}
int main() {
  long long a, b;
  cin >> a >> b;
  cout << (solve(b) - solve(a - 1) + mod) % mod << endl;
  return 0;
}
