#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e5 + 15;
const int inf = 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const int inv2 = (int)5e8 + 4;
inline int addMod(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }
inline int query(long long x) {
  int cnt[2] = {0};
  int tag = 1, sz = 1;
  long long bl = 1, pref = 1;
  for (; pref <= x; bl <<= 1, pref += bl, sz = addMod(sz, sz), tag = !tag) {
    cnt[tag] = addMod(cnt[tag], sz);
  }
  pref -= bl;
  cnt[tag] = addMod(cnt[tag], (x - pref) % MOD);
  int ret = (long long)(1 + cnt[0]) * cnt[0] % MOD;
  ret = addMod(ret, (long long)(1 + cnt[1]) * cnt[1] % MOD);
  ret = addMod(ret, MOD - cnt[1]);
  return ret;
}
int main() {
  long long l, r;
  while (~scanf("%lld%lld", &l, &r)) {
    int ans = addMod(query(r), MOD - query(l - 1));
    printf("%d\n", ans);
  }
}
