#include <bits/stdc++.h>
using namespace std;
long long int f(long long int n) {
  long long int a = 0, b = 0, i = 0, k = 1, s = 1;
  while (i < n) {
    if (k)
      a += min(n - i, s);
    else
      b += min(n - i, s);
    i += s;
    s = s * 2;
    k = k ^ 1;
  }
  a %= 1000000007;
  b %= 1000000007;
  return ((a * a) % 1000000007 + (b * b + b) % 1000000007) % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  long long int l, r;
  cin >> l >> r;
  cout << (f(r) - f(l - 1) + 1000000007) % 1000000007;
  return 0;
}
