#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1000005;
const long long SQRTN = 1003;
const long long LOGN = 22;
const double PI = acos(-1);
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const long long FMOD = 998244353;
const double eps = 1e-9;
void __print(long long x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long MOD2 = static_cast<long long>(MOD) * MOD;
struct Matrix {
  vector<vector<long long> > mat;
  long long n_rows, n_cols;
  Matrix() {}
  Matrix(vector<vector<long long> > values)
      : mat(values), n_rows(values.size()), n_cols(values[0].size()) {}
  static Matrix identity_matrix(long long n) {
    vector<vector<long long> > values(n, vector<long long>(n, 0));
    for (long long i = 0; i < n; i++) values[i][i] = 1;
    return values;
  }
  Matrix operator*(const Matrix &other) const {
    long long n = n_rows, m = other.n_cols;
    vector<vector<long long> > result(n_rows, vector<long long>(n_cols, 0));
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < m; j++) {
        long long tmp = 0;
        for (long long k = 0; k < n_cols; k++) {
          tmp += mat[i][k] * 1ll * other.mat[k][j];
          while (tmp >= MOD2) tmp -= MOD2;
        }
        result[i][j] = tmp % MOD;
      }
    return move(Matrix(move(result)));
  }
  inline bool is_square() const { return n_rows == n_cols; }
};
Matrix pw(Matrix a, long long p) {
  Matrix result = Matrix::identity_matrix(a.n_cols);
  while (p > 0) {
    if (p & 1) result = a * result;
    a = a * a;
    p >>= 1;
  }
  return result;
}
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long res = binpow(a, b / 2);
  if (b % 2)
    return res * res * a;
  else
    return res * res;
}
long long binpow2(long long a, long long b, long long c) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res *= a;
      res %= c;
    }
    a *= a;
    a %= c;
    b >>= 1;
  }
  return res % c;
}
long long inv(long long n) { return binpow2(n, MOD - 2, MOD); }
void solvethetestcase() {
  long long l, r;
  cin >> l >> r;
  long long n1 = r;
  long long x = 0;
  while (1) {
    n1 -= binpow(2, x);
    if (n1 < (binpow(2, x + 1))) {
      break;
    }
    x++;
  };
  long long dum1 = 0;
  if (x % 2) {
    long long to =
        ((((((binpow2(4, (x + 1) / 2, MOD) - 1 + 100 * MOD)) % MOD)) % MOD) *
         inv(3)) %
            MOD +
        n1 % MOD;
    to %= MOD;
    dum1 += to * to;
    dum1 %= MOD;
    long long te =
        (((((2 * (binpow2(4, (x + 1) / 2, MOD) - 1 + 100 * MOD)) % MOD)) %
          MOD) *
         inv(3)) %
        MOD;
    te %= MOD;
    dum1 += (te + 1) * te;
    dum1 %= MOD;
  } else {
    long long te =
        ((((((2 * (binpow2(4, (x) / 2, MOD) - 1 + 100 * MOD)) % MOD))) % MOD) *
         (inv(3) % MOD)) %
            MOD +
        n1 % MOD;
    te %= MOD;
    dum1 += te * (te + 1);
    dum1 %= MOD;
    long long to = (((binpow2(4, (x) / 2 + 1, MOD) - 1 + 100 * MOD)) % MOD) *
                   (inv(3) % MOD) % MOD;
    to %= MOD;
    dum1 += to * to;
    dum1 %= MOD;
  }
  l--;
  long long n2 = l;
  ;
  x = 0;
  if (n2 == 0) {
    cout << dum1 << "\n";
    return;
  }
  while (1) {
    n2 -= (1ll << x);
    if (n2 < (1ll << (x + 1))) {
      break;
    }
    x++;
  };
  long long dum2 = 0;
  if (x % 2) {
    long long to =
        (((((((binpow2(4, (x + 1) / 2, MOD) - 1 + 100 * MOD)) % MOD)) % MOD) *
          inv(3))) %
            MOD +
        n2 % MOD;
    to %= MOD;
    dum2 += to * to;
    dum2 %= MOD;
    long long te =
        (((((2 * (binpow2(4, (x + 1) / 2, MOD) - 1 + 100 * MOD)) % MOD)) %
          MOD) *
         inv(3)) %
        MOD % MOD;
    te %= MOD;
    dum2 += (te + 1) * te;
    dum2 %= MOD;
  } else {
    long long te =
        ((((((2 * (binpow2(4, (x) / 2, MOD) - 1 + 100 * MOD)) % MOD))) % MOD) *
         inv(3)) %
            MOD +
        n2 % MOD;
    te %= MOD;
    dum2 += te * (te + 1);
    dum2 %= MOD;
    long long to =
        ((((binpow2(4, (x) / 2 + 1, MOD) - 1 + 100 * MOD)) % MOD) * inv(3)) %
        MOD;
    to %= MOD;
    dum2 += to * to;
    dum2 %= MOD;
  };
  cout << (dum1 - dum2 + 100 * MOD) % MOD << "\n";
}
signed main() {
  cout << fixed << setprecision(12);
  ;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long testcase = 1; testcase < t + 1; testcase++) {
    solvethetestcase();
  }
}
