#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long b, long long p, long long md) {
  if (p == 0) return 1;
  if (p % 2 == 1) {
    return ((b % md) * bigmod(b, p - 1, md)) % md;
  } else {
    long long y = bigmod(b, p / 2, md);
    return (y * y) % md;
  }
}
long long solve(long long x) {
  long long odd = 0;
  long long even = 0;
  for (long long i = 0;; i++) {
    long long cnt = 1LL << i;
    if (i % 2 == 0) {
      odd += min(cnt, x);
      x -= min(x, cnt);
    } else {
      even += min(cnt, x);
      x -= min(cnt, x);
    }
    if (x <= 0) break;
  }
  odd = odd % 1000000007;
  even = even % 1000000007;
  long long res = (odd * odd) % 1000000007 + (even * (even + 1)) % 1000000007;
  res = res % 1000000007;
  return res;
}
int main() {
  long long l, r;
  cin >> l >> r;
  long long ans = solve(r) - solve(l - 1);
  ans = ans % 1000000007;
  if (ans < 0) ans += 1000000007;
  cout << ans << endl;
  return 0;
}
