AT_fps_24_j スゴロク
Description
There is a board game with $ N+1 $ squares numbered $ 0, 1, \dots, N $ .
You also have an $ M $ -sided die, where each side shows a distinct positive integer $ A_1, A_2, \dots, A_M $ with equal probability.
Additionally, there are traps on squares $ B_1, B_2, \dots, B_L $ . Here, $ 1 \leq B_i \leq N-1 $ , and all $ B_i $ are distinct.
You will play the following game:
- Place your piece on square $ 0 $ at the beginning. While the game continues, repeat:
- Roll the die. If your piece is on square $ x $ and the die shows $ y $ , move the piece to square $ \min(N, x+y) $ .
- If the piece lands on a trap square, you lose immediately.
- If the piece reaches square $ N $ without landing on a trap, you win immediately.
Compute the probability that you win the game, modulo $ 998244353 $ .
What does probability modulo $ 998244353 $ mean? It can be proven that the probability is always a rational number. Under the constraints of this problem, if the probability is written as $ \tfrac{P}{Q} $ with coprime integers $ P $ and $ Q $ , then there exists a unique integer $ R $ such that $ R \times Q \equiv P \pmod{998244353} $ and $ 0 \leq R < 998244353 $ . You are asked to compute this $ R $ .
Input Format
The input is given from standard input in the following format:
> $ N $ $ M $ $ L $ $ A_1 $ $ A_2 $ $ \dots $ $ A_M $ $ B_1 $ $ B_2 $ $ \dots $ $ B_L $
Output Format
Print the probability that you win the game, modulo $ 998244353 $ .
Explanation/Hint
### Sample Explanation 1
You can only win if the die shows $ 2 $ . Thus, the probability is $ \tfrac{1}{2} $ .
### Constraints
- $ 2 \leq N \leq 2.5 \times 10^5 $
- $ 1 \leq M \leq N $
- $ 1 \leq L \leq N-1 $
- $ 1 \leq A_1 < A_2 < \dots < A_M \leq N $
- $ 1 \leq B_1 < B_2 < \dots < B_L \leq N-1 $
- All input values are integers