I. Is This FWHT?
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Given $$$n$$$ and sequences $$$l_1, l_2, \ldots l_n$$$ and $$$r_1, r_2, \ldots r_n$$$.

Let's call a sequence of non-negative numbers $$$a_1, a_2, \ldots a_n$$$ good if $$$l_i \le a_i \le r_i$$$ and $$$a_1 \oplus a_2 \oplus \ldots \oplus a_n = 0$$$.

Find the number of different good sequences (modulo $$$998\,244\,353$$$, obviously).

Input

The first line contains one integer $$$n$$$ $$$(1 \le n \le 30)$$$ — length of the sequence.

The next $$$n$$$ lines contain two integers $$$l_i, r_i$$$ ($$$0 \le l_i \le r_i \le 2^{60} - 1$$$) — elements of the sequence.

Output

Print the answer.

Examples
Input
2
1 100
50 150
Output
51
Input
5
3 938
354 916
557 932
778 991
411 998
Output
35553823
Note

$$$a \oplus b$$$ is a well-known bitwise operation called XOR. For example, $$$5 \oplus 7 = 2$$$, $$$1 \oplus 2 = 3$$$, $$$6 \oplus 3 = 5$$$.