You have a $01$ sequence, which is initially empty. You can perform two types of operations on the sequence:
- Append a $0$ to the end of the sequence.
- Delete a subsequence from the sequence and append a $1$ to the end of the sequence. Let the chosen subsequence contain $x$ zeros and $y$ ones. The chosen subsequence must satisfy the following conditions:
- The subsequence cannot be empty, i.e., $x+y>0$.
- If $y>0$, then $x \in A$, where $A$ is a given set.
- If $y=0$, then $x \in B$, where $B$ is a given set.
You need to perform $n$ operations on the sequence. Find the number of different operation sequences such that the final sequence has a length of $1$. Two operation sequences are considered different if and only if the type of operation at some step is different, or if the subsequence chosen in a type-2 operation is different (subsequences are considered different if their positions are different, regardless of their values).
The answer should be modulo $998244353$.
Input
The first line contains three integers $n, |A|, |B|$, representing the number of operations, the size of set $A$, and the size of set $B$, respectively.
The second line contains $|A|$ integers $a_1, a_2, \dots, a_{|A|}$, describing the elements of set $A$.
The third line contains $|B|$ integers $b_1, b_2, \dots, b_{|B|}$, describing the elements of set $B$.
Output
Output a single integer representing the answer.
Examples
Input 1
4 1 1 1 1
Output 1
3
Input 2
10 10 10 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Output 2
362880
Subtasks
This problem uses bundled testing.
| Subtask | Score | Constraints |
|---|---|---|
| $1$ | $5$ | $n\leq 10$ |
| $2$ | $20$ | $n\leq 2000$ |
| $3$ | $5$ | $|A|=|B|=n$ |
| $4$ | $30$ | $A=B$ |
| $5$ | $40$ | No special constraints |
For all data, $1\leq n\leq 120000, 0\leq a_i, b_i < n$, all $a_i$ are distinct, and all $b_i$ are distinct.