#include <bits/stdc++.h>
using namespace std;
int i, j, cnt = 0;
long long p = 1000000007;
long long pre[100] = {0, 1};
long long a[100] = {1, 2};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long l, r, ans = 0;
  cin >> l >> r;
  for (int i = 2; i <= 60; i++) {
    a[i] = (a[i - 2] + (1ll << i - 1)) % p;
  }
  for (int i = 2; i <= 60; i++) {
    pre[i] = (a[i - 1] + (1ll << i - 1) - 1) % p * ((1ll << i - 1) % p) % p;
  }
  for (i = 1; i < 61; i++) pre[i] = (pre[i] + pre[i - 1]) % p;
  long long lb, rb, nl, nr;
  for (lb = 61; lb >= 0; lb--)
    if (l >> lb & 1) break;
  for (rb = 61; rb >= 0; rb--)
    if (r >> rb & 1) break;
  nl = l - (1ll << lb), nr = r - (1ll << rb) + 1;
  long long x = ((a[lb] + nl - 1 + p) % p * (nl % p) % p + pre[lb]) % p;
  long long y = ((a[rb] + nr - 1 + p) % p * (nr % p) % p + pre[rb]) % p;
  ans = (y - x + p) % p;
  cout << ans << '\n';
  return ~~(0 ^ 0 ^ 0);
}
