#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long po(long long a, long long b) {
  long long x = 1ll, y = a;
  while (b > 0) {
    if (b % 2) {
      x = (x * y) % mod;
    }
    y = (y * y) % mod;
    b /= 2;
  }
  return x;
}
long long solve(long long x) {
  if (x <= 0) {
    return 0ll;
  }
  bool odd = true;
  long long o = 0ll;
  long long e = 0ll;
  long long curr = 1;
  long long tot = 0ll;
  while (tot < x) {
    if (odd) {
      o += min(curr, x - tot);
    } else {
      e += min(curr, x - tot);
    }
    tot += curr;
    curr = (curr * 2ll);
    odd = !odd;
  }
  o %= mod;
  e %= mod;
  long long ans = (o * (2 + ((o - 1 + mod) % mod * 2ll)) % mod) % mod;
  ans = ans + (e * (4 + ((e - 1 + mod) % mod * 2ll)) % mod) % mod;
  ans = (ans * po(2, mod - 2)) % mod;
  return ans;
}
int main() {
  long long l, r;
  scanf("%lld %lld", &l, &r);
  printf("%lld\n", (solve(r) - solve(l - 1) + mod) % mod);
  return 0;
}
