#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long a[100], l, r;
long long wot(long long x) {
  long long odd = 0, even = 0, pos = 0, t;
  while (x > 0) {
    t = min(x, a[pos]);
    if (pos % 2 == 0) {
      even += t;
      even %= M;
      x -= t;
    } else {
      odd += t;
      odd %= M;
      x -= t;
    }
    pos++;
  }
  return (((even * even) % M) + ((odd * odd) % M) + odd + M) % M;
}
int main() {
  a[0] = 1;
  for (int i = 1; i <= 64; i++) {
    a[i] = a[i - 1] * 2;
  }
  cin >> l >> r;
  cout << (wot(r) - wot(l - 1) + M) % M << endl;
  return 0;
}
