#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<long long>;
using vvb = vector<vector<bool>>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vpii = vector<pair<int, int>>;
using mii = map<int, int>;
template <typename... ArgTypes>
void print(ArgTypes... args);
template <typename... ArgTypes>
void input(ArgTypes &...args);
template <>
void print() {}
template <>
void input() {}
template <typename T, typename... ArgTypes>
void print(T t, ArgTypes... args) {
  cout << t;
  print(args...);
}
template <typename T, typename... ArgTypes>
void input(T &t, ArgTypes &...args) {
  cin >> t;
  input(args...);
}
long long getSum(long long x) {
  long long a = 1, b = 2;
  long long now = 1;
  long long taken = 0;
  long long res = 0;
  while (taken < x) {
    long long take = now;
    if (taken + take > x) take = x - taken;
    long long temp = (a + take - 1LL) % 1000000007;
    temp = (take % 1000000007) * temp % 1000000007;
    res = (res + temp) % 1000000007;
    now <<= 1;
    a = (a + take * 2LL % 1000000007) % 1000000007;
    swap(a, b);
    taken += take;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long l, r;
  cin >> l >> r;
  cout << (getSum(r) - getSum(l - 1LL) + 1000000007) % 1000000007 << endl;
}
