#P1525E. Assimilation IV

    ID: 2190 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 7 Uploaded By: Tags>combinatoricsdpmathprobabilitiestwo pointers*2100

Assimilation IV

Description

Monocarp is playing a game "Assimilation IV". In this game he manages a great empire: builds cities and conquers new lands.

Monocarp's empire has nn cities. In order to conquer new lands he plans to build one Monument in each city. The game is turn-based and, since Monocarp is still amateur, he builds exactly one Monument per turn.

Monocarp has mm points on the map he'd like to control using the constructed Monuments. For each point he knows the distance between it and each city. Monuments work in the following way: when built in some city, a Monument controls all points at distance at most 11 to this city. Next turn, the Monument controls all points at distance at most 22, the turn after — at distance at most 33, and so on. Monocarp will build nn Monuments in nn turns and his empire will conquer all points that are controlled by at least one Monument.

Monocarp can't figure out any strategy, so during each turn he will choose a city for a Monument randomly among all remaining cities (cities without Monuments). Monocarp wants to know how many points (among mm of them) he will conquer at the end of turn number nn. Help him to calculate the expected number of conquered points!

The first line contains two integers nn and mm (1n201 \le n \le 20; 1m51041 \le m \le 5 \cdot 10^4) — the number of cities and the number of points.

Next nn lines contains mm integers each: the jj-th integer of the ii-th line di,jd_{i, j} (1di,jn+11 \le d_{i, j} \le n + 1) is the distance between the ii-th city and the jj-th point.

It can be shown that the expected number of points Monocarp conquers at the end of the nn-th turn can be represented as an irreducible fraction xy\frac{x}{y}. Print this fraction modulo 998244353998\,244\,353, i. e. value xy1mod998244353x \cdot y^{-1} \bmod 998244353 where y1y^{-1} is such number that yy1mod998244353=1y \cdot y^{-1} \bmod 998244353 = 1.

Input

The first line contains two integers nn and mm (1n201 \le n \le 20; 1m51041 \le m \le 5 \cdot 10^4) — the number of cities and the number of points.

Next nn lines contains mm integers each: the jj-th integer of the ii-th line di,jd_{i, j} (1di,jn+11 \le d_{i, j} \le n + 1) is the distance between the ii-th city and the jj-th point.

Output

It can be shown that the expected number of points Monocarp conquers at the end of the nn-th turn can be represented as an irreducible fraction xy\frac{x}{y}. Print this fraction modulo 998244353998\,244\,353, i. e. value xy1mod998244353x \cdot y^{-1} \bmod 998244353 where y1y^{-1} is such number that yy1mod998244353=1y \cdot y^{-1} \bmod 998244353 = 1.

Sample Input 1

3 5
1 4 4 3 4
1 4 1 4 2
1 4 4 4 3

Sample Output 1

166374062

Note

Let's look at all possible orders of cities Monuments will be build in:

  • [1,2,3][1, 2, 3]:
    • the first city controls all points at distance at most 33, in other words, points 11 and 44;
    • the second city controls all points at distance at most 22, or points 11, 33 and 55;
    • the third city controls all points at distance at most 11, or point 11.
    In total, 44 points are controlled.
  • [1,3,2][1, 3, 2]: the first city controls points 11 and 44; the second city — points 11 and 33; the third city — point 11. In total, 33 points.
  • [2,1,3][2, 1, 3]: the first city controls point 11; the second city — points 11, 33 and 55; the third city — point 11. In total, 33 points.
  • [2,3,1][2, 3, 1]: the first city controls point 11; the second city — points 11, 33 and 55; the third city — point 11. In total, 33 points.
  • [3,1,2][3, 1, 2]: the first city controls point 11; the second city — points 11 and 33; the third city — points 11 and 55. In total, 33 points.
  • [3,2,1][3, 2, 1]: the first city controls point 11; the second city — points 11, 33 and 55; the third city — points 11 and 55. In total, 33 points.
The expected number of controlled points is 4+3+3+3+3+36\frac{4 + 3 + 3 + 3 + 3 + 3}{6} == 196\frac{19}{6} or 196119 \cdot 6^{-1} \equiv 1916637405919 \cdot 166374059 \equiv 166374062166374062 (mod998244353)\pmod{998244353}