#include <bits/stdc++.h>
using namespace std;
long long int m = 1e9 + 7;
long long int f(long long int l) {
  long long int n = floor(log2(l + 1));
  long long int ans = 0;
  long long int y = l - (pow(2, n) - 1);
  y = y % m;
  if (n % 2 != 0) {
    long long int odd = (pow(4, (n / 2) + 1) - 1) / 3;
    odd = odd % m;
    ans = (m + ans + (odd * odd) % m) % m;
    long long int even = (2 * (pow(4, n / 2) - 1)) / 3;
    even = even % m;
    ans = (ans + (even * (even + 1)) % m) % m;
    if (y != 0) {
      ans = (ans + ((((2 * (even + 1)) % m + y - 1) % m) * y) % m) % m;
    }
  } else {
    long long int odd = (pow(4, n / 2) - 1) / 3;
    odd = odd % m;
    ans = (ans + (odd * odd) % m) % m;
    long long int even = 2 * (pow(4, n / 2) - 1) / 3;
    even = even % m;
    ans = (ans + (even * (even + 1)) % m) % m;
    if (y != 0) {
      ans = (ans + (((((2 * (odd + 1)) % m - 1) + y - 1) % m) * y) % m) % m;
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int l, r;
  cin >> l >> r;
  cout << (f(r) - f(l - 1) + m) % m << '\n';
}
