#include <bits/stdc++.h>
using namespace std;
long long powmod(long long base, long long exp) {
  base %= ((int)1e9 + 7);
  long long result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % ((int)1e9 + 7);
    base = (base * base) % ((int)1e9 + 7);
    exp >>= 1;
  }
  return result % ((int)1e9 + 7);
}
long long inv(long long x) {
  return powmod(x, ((int)1e9 + 7) - 2) % ((int)1e9 + 7);
}
long long sum_to(long long x) {
  if (x < 0) return 0;
  return (((x * (x + 1)) % ((int)1e9 + 7)) * inv(2)) % ((int)1e9 + 7);
}
long long sq(long long x) { return (x * x) % ((int)1e9 + 7); }
long long sumodd(long long o) {
  long long x = o / 2;
  x %= ((int)1e9 + 7);
  return sq(x + 1) % ((int)1e9 + 7);
}
long long sumeven(long long e) {
  e /= 2;
  e %= ((int)1e9 + 7);
  return (2 * sum_to(e)) % ((int)1e9 + 7);
}
long long f(long long x) {
  if (x == 0) return 0;
  if (x == 1) return 1;
  if (x == 2) return 3;
  long long k = 0;
  for (;; k++)
    if ((1LL << k) - 1 > x) break;
  k--;
  long long e = 2, o = 1;
  long long adde = 4, addo = 2;
  for (int i = int(0); i < int(k / 2 - 1); i++) {
    e += adde;
    o += addo;
    adde *= 4;
    addo *= 4;
  }
  long long d = x - ((1LL << k) - 1);
  if (k & 1) o = (o + addo);
  if (k & 1) {
    o = (o + 2 * ((1LL << (k - 1)) - 1));
    e = (e + 2 * ((1LL << (k - 2)) - 1));
    e = (e + 2 * d);
  } else {
    o = (o + 2 * ((1LL << (k - 2)) - 1));
    e = (e + 2 * ((1LL << (k - 1)) - 1));
    o = (o + 2 * d);
  }
  return ((sumodd(o) + sumeven(e)) % ((int)1e9 + 7) + ((int)1e9 + 7)) %
         ((int)1e9 + 7);
}
int main() {
  ios::sync_with_stdio(false);
  long long l, r;
  cin >> l >> r;
  cout << (f(r) - f(l - 1) + ((int)1e9 + 7)) % ((int)1e9 + 7) << '\n';
  return 0;
}
