#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int l, r, ans;
long long int get(long long int x) {
  long long int now = 1, k, a[2] = {0, 0};
  int id = 0;
  while (x > 0) {
    k = min(now, x);
    a[id] = (k + a[id]) % mod;
    id ^= 1;
    now *= 2;
    x -= k;
  }
  return (a[0] * (a[0]) % mod + a[1] * (a[1] + 1) % mod) % mod;
}
int main(int argc, char const *argv[]) {
  scanf("%lld%lld", &l, &r);
  printf("%lld\n", (get(r) - get(l - 1) + mod) % mod);
  return 0;
}
