#include <bits/stdc++.h>
using namespace std;
long long fun(long long a) {
  long long p = 1, co = 0, ce = 0;
  long b = 0;
  long long sum = 0;
  while (true) {
    if (b % 2 == 0) {
      sum += p;
      if (sum < a)
        co = (co + p) % 1000000007;
      else {
        co = (co + a - (sum - p) % 1000000007) % 1000000007;
        break;
      }
    } else {
      sum += p;
      if (sum < a)
        ce = (ce + p) % 1000000007;
      else {
        ce = (ce + a - (sum - p) % 1000000007) % 1000000007;
        break;
      }
    }
    p = p * 2;
    b++;
  }
  return ((((ce % 1000000007) * (ce + 1) % 1000000007) % 1000000007) +
          ((co % 1000000007) * (co % 1000000007)) % 1000000007) %
         1000000007;
}
int main() {
  long long l, r;
  cin >> l >> r;
  long long a = (fun(r) - fun(l - 1) + 1000000007) % 1000000007;
  cout << a;
  return 0;
}
