8531: Electrician

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

NIO would like to be an electrician.

He is now confronted with a difficult task. The device he is working on has a circular frame and there are N equidistant vertices on the frame. It can be simplified to a circle on a two-dimensional plane. In addition to the outermost circular frame, there are also vertices on the frame. It can be simplified to a circle on a two-dimensional plane. In addition to the outermost circular frame, there are also M holders inside which can be simplified to segments connecting the vertices on the circle. Because these holders are produced together, they are all the same "length" L. "Length" L means that if a segment start at i-th vertex, it would end at (i+L)-th vertex and i must satisfy (1≤i≤N−L)


The task is to place two wires on the frame, one from vertex 1 to N and another from 2 to N−1. The wires must be close to the segments or arcs on the frame and on where two segments intersect, a wire can also be connected from one segment to another.




For safety, two wires cannot intersect at any position, that is, they can not pass through the same vertex or intersections of segments, including vertex 1, 2, For safety, two wires cannot intersect at any position, that is, they can not pass through the same vertex or intersections of segments, including vertices 1, 2, N−1 and N. And on any segment and arc, the wire must follow the direction from the vertex with the small number to the vertex with the large number.


NIO wants to know how many schemes he has for placing wires.


Since the answer is too large, NIO only wants to know it modulo 998244353.

输入格式

The first line contains two integers N, M, L(4≤N≤106,0≤M≤104,1≤L<N/2).
The following line contains M distinct integers {si}(1≤si≤N−L), donating that there is a segment connecting si and (si+L).

输出格式

A single non-negative integer, denoting the answer, modulo 998244353.

输入样例 复制

6 3 1
1 2 3

输出样例 复制

4

分类标签