#include <bits/stdc++.h>
using namespace std;
const int N = 555;
const int MOD = 1e9 + 7;
void add(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
int mul(long long a, long long b) { return 1LL * (a % MOD) * (b % MOD) % MOD; }
int sum_first_odd(long long x) { return mul(x, x); }
int sum_posit(long long x) { return mul(x, x + 1); }
int sum_p(long long l, long long r) {
  int a = sum_posit(r);
  add(a, MOD - sum_posit(l - 1));
  return a;
}
int sum_i(long long l, long long r) {
  int a = sum_first_odd(r);
  add(a, MOD - sum_first_odd(l - 1));
  return a;
}
int solve(long long x) {
  long long curr = 1;
  long long step = 1;
  int ty = 0;
  int ans = 0;
  long long pair_p = 1;
  long long imp_p = 1;
  while (curr <= x) {
    long long l = curr;
    long long r = min(curr + step - 1, x);
    long long cnt = r - l + 1;
    if (ty == 1) {
      add(ans, sum_p(pair_p, pair_p + cnt - 1));
      pair_p += cnt;
    } else {
      add(ans, sum_i(imp_p, imp_p + cnt - 1));
      imp_p += cnt;
    }
    curr = curr + step;
    step = step * 2;
    ty = 1 - ty;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long l, r;
  cin >> l >> r;
  int a = solve(r);
  int b = solve(l - 1);
  add(a, MOD - b);
  cout << a << '\n';
}
