#include <bits/stdc++.h>
using namespace std;
const long long int N = 1000005;
const long long int LG = 22;
long long int sum(long long int x) {
  long long int even = 0, odd = 0, c = 0;
  long long int ge = 0, go = 0;
  long long int power = 1;
  while (1) {
    c++;
    if (x - power < 0) break;
    x -= power;
    if (c % 2 == 1)
      odd += power, go++;
    else
      even += power, ge++;
    power *= 2;
  }
  long long int cur = 0;
  if (x > 0) {
    x %= 1000000007;
    if ((ge + go) % 2 == 0) {
      long long int st = 2 * odd + 1;
      cur = (st + x - 1 + 1000000007) % 1000000007;
      cur = (cur * x) % 1000000007;
    } else {
      long long int st = 2 * even + 2;
      cur = (st + x - 1 + 1000000007) % 1000000007;
      cur = (cur * x) % 1000000007;
    }
  }
  even %= 1000000007;
  odd %= 1000000007;
  long long int lol = (odd * odd) % 1000000007;
  lol = (lol + ((even) * (even + 1)) % 1000000007) % 1000000007;
  lol = (lol + cur) % 1000000007;
  return lol % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int l, r;
  cin >> l >> r;
  cout << (sum(r) - sum(l - 1) + 1000000007) % 1000000007 << endl;
  return 0;
}
