#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char c = getchar();
  long long x = 0, f = 1;
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
inline long long qpw(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return res;
}
long long l, r, inv3 = qpw(3, 1000000007 - 2);
inline long long s1(long long n) { return n * n % 1000000007; }
inline long long s2(long long n) { return n * (n + 1) % 1000000007; }
inline long long calc(long long x) {
  if (!x) return 0;
  long long q = 1, n = 1;
  while ((q << 1) - 1 < x) n++, q <<= 1;
  long long a = n / 2, b = a;
  if (!(n & 1)) b--;
  a = (qpw(4, a) - 1) * inv3 % 1000000007;
  if (n & 1) a += (x - qpw(2, n - 1) + 1) % 1000000007;
  b = 2ll * (qpw(4, b) - 1) % 1000000007 * inv3 % 1000000007;
  if (!(n & 1)) b += (x - qpw(2, n - 1) + 1) % 1000000007;
  a %= 1000000007, b %= 1000000007;
  return (s1(a) + s2(b)) % 1000000007;
}
signed main() {
  l = read(), r = read();
  cout << (calc(r) - calc(l - 1) + 1000000007) % 1000000007 << endl;
}
