Define a block in a binary string (a string consisting of characters 0 and/or 1) as its continuous substring of characters of the same type that cannot be extended either to the left or to the right. For example, in the string 110001111, there are three blocks:
The substring from the $$$7$$$-th character to the $$$9$$$-th character 111 is not a block because it can be extended to the left. The substring from the $$$1$$$-st character to the $$$5$$$-th character 11000 is not a block because it contains characters of different types.
We call a string beautiful if we can remove exactly one block from it so that the resulting string consists of an odd number of blocks. For example:
You are given an integer $$$n$$$ and $$$m$$$ constraints, the $$$i$$$-th of which is described by a pair of integers $$$l_i, r_i$$$. We denote the substring of the string $$$s$$$ from character $$$l$$$ to character $$$r$$$ inclusive as $$$s[l:r]$$$, that is, $$$s[l:r] = s_l s_{l+1} \dots s_r$$$. Your task is to count the number of binary strings $$$s$$$ of length $$$n$$$ meeting the following condition:
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test case.
The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 3 \cdot 10^5$$$; $$$1 \le m \le 3 \cdot 10^5$$$) — the required length of the string and the number of constraints, respectively.
Next, there are $$$m$$$ lines, the $$$i$$$-th of which contains two integers $$$l_i, r_i$$$ ($$$1 \le l_i \lt r_i \le n$$$) — the description of the $$$i$$$-th constraint.
Additional constraints on the input:
For each test case, print one integer — the number of strings that satisfy the condition. Since it may be huge, output it modulo $$$998244353$$$.
34 31 22 33 44 21 23 4200 113 37
24570529459
In the first example from the statement, the following strings are suitable: 1010, 0101. For each of these strings, both $$$s[1:2]$$$, $$$s[2:3]$$$, and $$$s[3:4]$$$ are beautiful.
| Name |
|---|


