#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long int a, b, c, d, e, f, g, h[100005], arr[100005], sumodd[100],
    sumeven[100];
string s;
vector<long long int> v;
char ch;
long long int fastpower(long long int a, long long int b) {
  if (b == 1) return a;
  long long int c = fastpower(a, b / 2) % mod;
  if (b % 2 == 0)
    return c * c % mod;
  else
    return (c * c) % mod * a % mod;
}
int main() {
  cin >> a >> b;
  h[0] = 1;
  for (long long int i = 1; i <= 70; i++) {
    h[i] = h[i - 1] * 2;
  }
  sumeven[1] = 1;
  for (long long int i = 3; i <= 70; i += 2) {
    sumeven[i] = sumeven[i - 2] + h[i - 2];
    sumeven[i] %= mod;
  }
  sumodd[0] = 1;
  for (long long int i = 2; i <= 70; i += 2) {
    sumodd[i] = sumodd[i - 2] + h[i - 2];
    sumodd[i] %= mod;
  }
  long long int x;
  for (long long int i = 0; i <= a; i++) {
    if (h[i] > a) {
      x = i - 1;
      break;
    }
  }
  long long int oddstart, evenstart, oddend, evenend;
  if (x % 2 == 0) {
    oddstart = sumodd[x] % mod;
    oddstart += (a - h[x]) % mod;
    evenstart = sumeven[x + 1] % mod;
  } else {
    evenstart = sumeven[x] % mod;
    evenstart += (a - h[x]) % mod;
    oddstart = (sumodd[x + 1]) % mod;
  }
  for (long long int i = 0; i <= b; i++) {
    if (h[i] > b) {
      x = i;
      break;
    }
  }
  if (x % 2 == 0) {
    oddend = (sumodd[x] - 1) % mod;
    evenend = sumeven[x - 1] % mod;
    evenend += (b - h[x - 1]) % mod;
  } else {
    evenend = (sumeven[x] - 1) % mod;
    oddend = sumodd[x - 1] % mod;
    oddend += (b - h[x - 1]) % mod;
  }
  oddstart %= mod, oddend %= mod, evenstart %= mod, evenend %= mod;
  cout << (long long int)(((((2 * oddstart - 1 + mod) % mod +
                             (2 * oddend - 1 + mod) % mod + mod) %
                                mod * (oddend - oddstart + 1 + mod) % mod +
                            mod) %
                               mod +
                           (((2 * evenstart + mod) % mod +
                             (2 * evenend + mod) % mod + mod) %
                                mod * (evenend - evenstart + 1 + mod) % mod +
                            mod) %
                               mod +
                           mod) %
                          mod) *
              fastpower(2, mod - 2) % mod
       << endl;
}
