#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int poww(long long int b, long long int e) {
  if (e == 0)
    return 1;
  else if (e % 2 == 0) {
    long long int a = pow(b, e / 2);
    return a * a;
  } else {
    long long int a = pow(b, e / 2);
    return b * a * a;
  }
}
long long int powm(long long int x, long long int y,
                   long long int m = 1000000007) {
  x = x % m;
  long long int res = 1;
  while (y) {
    if (y & 1) res = res * x;
    res %= m;
    y = y >> 1;
    x = x * x;
    x %= m;
  }
  return res;
}
long long int modInverse(long long int a, long long int m = 1000000007) {
  if (m == 1) return 0;
  long long int m0 = m, y = 0, x = 1;
  while (a > 1) {
    long long int q = a / m, t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long int cal(long long int r) {
  long long int ans = 0;
  long long int val = 1;
  long long int prevo = 0;
  while (val <= r) {
    long long int a = prevo * 2 + 1;
    long long int diff = 2;
    long long int n = min(val, r - val + 1);
    ans += (((n % 1000000007) * (a % 1000000007)) % 1000000007) +
           (((n % 1000000007) * ((n - 1) % 1000000007)) % 1000000007);
    ans %= 1000000007;
    prevo += val;
    val *= 4;
  }
  val = 2, prevo = 0;
  while (val <= r) {
    long long int a = prevo * 2 + 2;
    long long int diff = 2;
    long long int n = min(val, r - val + 1);
    ans += (((n % 1000000007) * (a % 1000000007)) % 1000000007) +
           (((n % 1000000007) * ((n - 1) % 1000000007)) % 1000000007);
    ans %= 1000000007;
    prevo += val;
    val *= 4;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int l, r, ans = 0;
  cin >> l >> r;
  ans = (cal(r) - cal(l - 1) + 1000000007) % 1000000007;
  cout << ans;
  return 0;
}
