#include <bits/stdc++.h>
using namespace std;
long long add(long long a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return a;
}
long long mul(long long a, long long b) {
  return ((a % 1000000007) * (b % 1000000007)) % 1000000007;
}
long long binary_expo(long long base, long long expo) {
  long long res = 1;
  while (expo) {
    if (expo % 2) {
      res = mul(res, base);
    }
    expo /= 2;
    base = mul(base, base);
  }
  return res;
}
long long A[62];
long long fnc(long long n) {
  long long x = 0;
  long long sum = 0;
  long long odd = 0, even = 0;
  for (long long i = 0; i <= 61; i++) {
    sum += A[i];
    if (sum > n) {
      sum -= A[i];
      break;
    }
    if (x == 0) {
      odd += A[i];
    } else {
      even += A[i];
    }
    x ^= 1;
  }
  if (x == 0) {
    odd += (n - sum);
  } else {
    even += (n - sum);
  }
  long long a = mul(odd, add(1, (odd - 1)));
  long long b = mul(even, add(2, (even - 1)));
  return add(a, b);
}
void solve(long long tc) {
  long long l, r;
  A[0] = 1;
  for (long long i = 1; i <= 61; i++) {
    A[i] = A[i - 1] * 2;
  }
  cin >> l >> r;
  long long a = fnc(r);
  long long b = fnc(l - 1);
  cout << (a - b + 1000000007) % 1000000007 << endl;
}
signed main() {
  long long t;
  ios_base::sync_with_stdio(false);
  t = 1;
  long long tc = 1;
  while (t--) {
    solve(tc++);
  }
  return 0;
}
