P10008 [CTT Mutual Test 2022] Range Minimum Element

Description

There is a positive integer sequence $a$ of length $n$, with values in $[1,c]$. Given $m$ intervals $[l_i,r_i]$, define a sequence $b$ of length $m$ such that $\forall i\in [1,m],b_i=\min\limits_{j=l_i}^{r_i}\{a_j\}$. Find how many different $b$ can be obtained when $a$ can be chosen arbitrarily within the range. Output the answer modulo $998244353$.

Input Format

The first line contains three integers, which are $n,m,c$ in order. The next $m$ lines each contain two integers $l_i,r_i$, representing a given interval.

Output Format

Output one line containing one integer, the answer.

Explanation/Hint

For $100\%$ of the testdata, $1\le n\le 100,1\le m\le\dfrac{n(n+1)}{2},1\le c