#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); };
long long power(long long b, long long e) {
  long long enc = 1;
  b %= (1000000007);
  while (e > 0) {
    if (e & 1) enc = (enc * b) % (1000000007);
    e >>= 1;
    b = (b * b) % (1000000007);
  }
  return enc;
}
long long f(long long x) {
  pair<long long, long long> sum;
  for (int i = 0; i >= 0; i++) {
    long long pp = (1ll << i);
    if (i % 2 == 0) {
      sum.first = (sum.first + min(x, pp));
    } else {
      sum.second = (sum.second + min(x, pp));
    }
    x -= pp;
    if (x <= 0) break;
  }
  long long s1 =
      ((sum.first % (1000000007)) * (sum.first % (1000000007))) % (1000000007);
  long long s2 =
      ((sum.second % (1000000007)) * ((sum.second + 1) % (1000000007))) %
      (1000000007);
  return (s1 + s2) % (1000000007);
}
int main() {
  std::ios::sync_with_stdio(false);
  long long l, r;
  cin >> l >> r;
  long long a1 = f(r);
  long long a2 = f(l - 1);
  cout << ((a1 - a2) + (1000000007)) % (1000000007) << "\n";
};
