atcoder#ABC138F. [ABC138F] Coincidence

[ABC138F] Coincidence

Score : 600600 points

Problem Statement

Given are integers LL and RR. Find the number, modulo 109+710^9 + 7, of pairs of integers (x,y)(x, y) (LxyR)(L \leq x \leq y \leq R) such that the remainder when yy is divided by xx is equal to y XOR xy \text{ XOR } x.

What is $\text{ XOR }$?

The XOR of integers AA and BB, A XOR BA \text{ XOR } B, is defined as follows:

  • When A XOR BA \text{ XOR } B is written in base two, the digit in the 2k2^k's place (k0k \geq 0) is 11 if either AA or BB, but not both, has 11 in the 2k2^k's place, and 00 otherwise.

For example, 3 XOR 5=63 \text{ XOR } 5 = 6. (In base two: 011 XOR 101=110011 \text{ XOR } 101 = 110.)

Constraints

  • 1LR10181 \leq L \leq R \leq 10^{18}

Input

Input is given from Standard Input in the following format:

LL RR

Output

Print the number of pairs of integers (x,y)(x, y) (LxyR)(L \leq x \leq y \leq R) satisfying the condition, modulo 109+710^9 + 7.

2 3
3

Three pairs satisfy the condition: (2,2)(2, 2), (2,3)(2, 3), and (3,3)(3, 3).

10 100
604
1 1000000000000000000
68038601

Be sure to compute the number modulo 109+710^9 + 7.