#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long get_(long long a1, long long n) {
  if (n == 1) return a1;
  return (((a1 % mod) * (n % mod)) % mod + (n % mod) * ((n - 1) % mod) % mod) %
         mod;
}
long long get_sum(long long x) {
  long long n1 = 1, n2 = 2;
  long long num = 1, sum = 0;
  for (int i = 1; x; i++) {
    if (i & 1) {
      sum += get_(n1, min(x, num));
      sum %= mod;
      x -= min(x, num);
      n1 += 2 * num;
    } else {
      sum += get_(n2, min(x, num));
      sum %= mod;
      x -= min(x, num);
      n2 += 2 * num;
    }
    num <<= 1;
  }
  return sum;
}
int main(int argc, char** argv) {
  long long l, r;
  cin >> l >> r;
  long long res = (get_sum(r) - get_sum(l - 1) + mod) % mod;
  cout << res << endl;
  return 0;
}
