#include <bits/stdc++.h>
using namespace std;
long long int power(long long int b, long long int x) {
  long long int ans = 1;
  while (x > 0) {
    if (x & 1) {
      ans = (ans * b) % 1000000007;
    }
    b = (b * b) % 1000000007;
    x >>= 1;
  }
  return ans % 1000000007;
}
long long int sum(long long int n) {
  if (n <= 1) return n;
  long long int lg = log2l(n), le, lo;
  if (lg & 1) {
    lo = max(0LL, lg - 1);
    le = max(0LL, lg - 2);
  } else {
    le = max(0LL, lg - 1);
    lo = max(0LL, lg - 2);
  }
  long long int ne =
      ((power(2, (le + 2)) - 2) * power(3, 1000000007 - 2)) % 1000000007;
  long long int no =
      ((power(2, (lo + 2)) - 1) * power(3, 1000000007 - 2)) % 1000000007;
  long long int tmp = (n % 1000000007 - ne - no) % 1000000007;
  if (lg & 1) {
    ne += tmp;
  } else
    no += tmp;
  tmp = (no % 1000000007 * no % 1000000007) % 1000000007;
  tmp += (ne % 1000000007 * (ne + 1) % 1000000007) % 1000000007;
  return tmp % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int l, r, s;
  cin >> l >> r;
  s = (sum(r) - sum(l - 1)) % 1000000007;
  s = (s + 1000000007) % 1000000007;
  cout << s;
  return 0;
}
