#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  if (b < 0) return 1;
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b >>= 1;
  }
  return res;
}
bool ispoweroftwo(long long x) { return (x && !(x & (x - 1))); }
long long GCD(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
const long long inf = 1e9;
const long long INF = 1e18;
const long double pi = 3.141592653589793238;
long long dx[] = {-1, 0, 1, 0};
long long dy[] = {0, 1, 0, -1};
char MV[] = {'U', 'R', 'D', 'L'};
long long solve(long long n) {
  long long cure = 0, curo = 0;
  if (n == 0) return 0;
  for (long long i = 0; i < 60; ++i) {
    long long p = (1ll << i);
    if (i & 1) {
      cure += min(n * 1ll, p);
      cure %= 1000000007;
    } else {
      curo += min(n * 1ll, p);
      curo %= 1000000007;
    }
    n -= p;
    if (n <= 0) break;
  }
  long long esum = (cure % 1000000007 * (cure + 1) % 1000000007) % 1000000007;
  long long osum = (curo % 1000000007 * curo % 1000000007) % 1000000007;
  return (esum % 1000000007 + osum % 1000000007) % 1000000007;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long l, r;
  cin >> l >> r;
  long long ans =
      (solve(r) % 1000000007 - solve(l - 1) % 1000000007 + 1000000007) %
      1000000007;
  cout << ans;
  return 0;
}
