Monocarp's realm has n urban communities. To vanquish new grounds he intends to construct one Monument in every city. The game is turn-based and, since Monocarp is as yet beginner, he fabricates precisely one Monument for each turn. Monocarp has m focuses on the guide he'd prefer to control utilizing the developed Monuments
Correct answer will be upvoted else downvoted.
Monocarp's realm has n urban communities. To vanquish new grounds he intends to construct one Monument in every city. The game is turn-based and, since Monocarp is as yet beginner, he fabricates precisely one Monument for each turn.
Monocarp has m focuses on the guide he'd prefer to control utilizing the developed Monuments. For each point he knows the distance among it and every city. Landmarks work in the accompanying manner: when implicit some city, a Monument controls all focuses at distance all things considered 1 to this city. Next turn, the Monument controls all focuses at distance all things considered 2, the turn after — at distance all things considered 3, etc. Monocarp will construct n Monuments in n turns and his domain will overcome all focuses that are constrained by somewhere around one Monument.
Monocarp can't sort out any system, so during each turn he will pick a city for a Monument arbitrarily among every leftover city (urban areas without Monuments). Monocarp needs to know the number of focuses (among m of them) he will vanquish toward the finish of turn number n. Assist him with working out the normal number of vanquished focuses!
Input
The principal line contains two integers n and m (1≤n≤20; 1≤m≤5⋅104) — the number of urban communities and the number of focuses.
Next n lines contains m integers each: the j-th integer of the I-th line di,j (1≤di,j≤n+1) is the distance between the I-th city and the j-th point.
Output
It very well may be shown that the normal number of focuses Monocarp vanquishes toward the finish of the n-th turn can be addressed as an unchangeable portion xy. Print this part modulo 998244353, I. e. esteem x⋅y−1mod998244353 where y−1 is such number that y⋅y−1mod998244353=1.
Step by step
Solved in 3 steps with 1 images