#include <bits/stdc++.h>
using namespace std;
int ini() {
  int x;
  scanf("%d", &x);
  return x;
}
long long inl() {
  long long x;
  scanf("%lld", &x);
  return x;
}
long long pw[105];
long long cal(long long n) {
  long long id = 0, cn = 0;
  for (int i = 0; i <= 61; i += 2) {
    if (id + pw[i] >= n) {
      cn = (cn + n - id) % 1000000007;
      break;
    } else {
      cn = (cn + pw[i]) % 1000000007;
      id += pw[i];
    }
    id += pw[i + 1];
    if (id >= n) break;
  }
  long long res = (cn * cn) % 1000000007;
  id = 0, cn = 0;
  for (int i = 1; i <= 61; i += 2) {
    id += pw[i - 1];
    if (id >= n) break;
    if (id + pw[i] >= n) {
      cn = (cn + n - id) % 1000000007;
      break;
    } else {
      cn = (cn + pw[i]) % 1000000007;
      id += pw[i];
    }
  }
  res = (res + (cn * (cn + 1)) % 1000000007) % 1000000007;
  return res;
}
int main() {
  pw[0] = 1;
  for (int i = 1; i <= 62; i++) pw[i] = pw[i - 1] * 2LL;
  long long l = inl(), r = inl();
  cout << (cal(r) - cal(l - 1) + 1000000007) % 1000000007 << "\n";
  return 0;
}
