#include <bits/stdc++.h>
using namespace std;
long long int po(long long int n, long long int l) {
  long long int ans = 1;
  while (l--) ans *= n;
  return ans;
}
int main() {
  long long int a, b, l = 0, k = 0, f, ans, x = 0, y = 0;
  scanf("%I64d%I64d", &a, &b);
  long long int c = a, d = b;
  while (c > 0) {
    c /= 2;
    l++;
  }
  while (d > 0) {
    d /= 2;
    k++;
  }
  l--;
  k--;
  x = a - po(2, l);
  y = b - po(2, k);
  long long int bb = 0, pp = 0;
  for (int i = l; i < k; i++) {
    if (i % 2 == 0) {
      bb += po(2, i);
    } else
      pp += po(2, i);
  }
  if (k % 2 == 0)
    bb += y + 1;
  else
    pp += y + 1;
  long long int sub = 0;
  long long int ss = 0;
  for (int i = 1; i < l; i += 2) ss += po(2, i);
  for (int i = 0; i < l; i += 2) sub += po(2, i);
  bb += sub;
  pp += ss;
  if (l % 2 == 0)
    sub += x;
  else
    ss += x;
  bb = bb % 1000000007;
  sub = sub % 1000000007;
  pp = pp % 1000000007;
  ss = ss % 1000000007;
  cout << ((bb * bb) - (sub * sub) % 1000000007 + (pp * (pp + 1)) -
           (ss * (ss + 1)) % 1000000007) %
              1000000007
       << endl;
}
