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 n 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 m 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 1 to this city. Next turn, the Monument controls all points at distance at most 2, the turn after — at distance at most 3, and so on. Monocarp will build n Monuments in n 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 m of them) he will conquer at the end of turn number n. Help him to calculate the expected number of conquered points!

Input

The first line contains two integers n and m (1 ≤ n ≤ 20; 1 ≤ m ≤ 5 ⋅ 10^4) — the number of cities and the number of points.

Next n lines contains m integers each: the j-th integer of the i-th line d_{i, j} (1 ≤ d_{i, j} ≤ n + 1) is the distance between the i-th city and the j-th point.

Output

It can be shown that the expected number of points Monocarp conquers at the end of the n-th turn can be represented as an irreducible fraction x/y. Print this fraction modulo 998 244 353, i. e. value x ⋅ y^{-1} mod 998244353 where y^{-1} is such number that y ⋅ y^{-1} mod 998244353 = 1.

Example

Input


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


Output


166374062

Note

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

  * [1, 2, 3]: 
    * the first city controls all points at distance at most 3, in other words, points 1 and 4; 
    * the second city controls all points at distance at most 2, or points 1, 3 and 5; 
    * the third city controls all points at distance at most 1, or point 1. 
In total, 4 points are controlled. 
  * [1, 3, 2]: the first city controls points 1 and 4; the second city — points 1 and 3; the third city — point 1. In total, 3 points. 
  * [2, 1, 3]: the first city controls point 1; the second city — points 1, 3 and 5; the third city — point 1. In total, 3 points. 
  * [2, 3, 1]: the first city controls point 1; the second city — points 1, 3 and 5; the third city — point 1. In total, 3 points. 
  * [3, 1, 2]: the first city controls point 1; the second city — points 1 and 3; the third city — points 1 and 5. In total, 3 points. 
  * [3, 2, 1]: the first city controls point 1; the second city — points 1, 3 and 5; the third city — points 1 and 5. In total, 3 points. 

The expected number of controlled points is (4 + 3 + 3 + 3 + 3 + 3)/(6) = 19/6 or 19 ⋅ 6^{-1} ≡ 19 ⋅ 166374059 ≡ 166374062 \pmod{998244353}
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma,sse,sse2,sse3,sse4") /* q,n <= 200000 */
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std ;
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define index(a) order_of_key(a) // return type value ie how many elements strictly smaller than a;
#define _value(a) find_by_order(a)  //(arr+a) return type pointer
 */
#define int long long
#define PIE acos(-1)
#define rl(i,n)        for(int i=0;i<n;i++)
#define ll             long long
#define ld             long double
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define sz(a)          (int)((a).size())
#define IOS            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define edl             "\n"
#define lll __uint128_t
#define bit_count(n) bitcount(n)
#define _name_(x) cout << (#x)
using namespace std;
inline ll __gcd(ll a,ll b);
void pdash(int n=30);int bitcount(ll u);
ll power(ll x,ll y);ll power(ll x,ll y,ll z);

vector<int > cordinate_compression(vector<int>& v);   // return access vector so that we can keep track of real entity;
void make_uniquee(vector<int>& vec);        // notice the strange fn_name
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll myrand(ll mod=1000000009);
void custome_random_shuffle(vector<int>& vec){shuffle(all(vec),rng);return;}
void svec(vector<int>& vec);void smap(vector<int,int>& mp);void sset(set<int >& st);
//void dpprint(vector<vector<ll>>& dp);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
const int NC=60005;
ll inv[NC],fac_inv[NC],fac[NC];
const ll MOD = 998244353;
void initialize()
{
    ll i;
    inv[1]=1;
    for(i=2;i<=NC-2;i++)
        inv[i]=(MOD-MOD/i)*inv[MOD%i]%MOD;
    fac[0]=fac[1]=1;
    for(i=2;i<=NC-2;i++)
        fac[i]=i*fac[i-1]%MOD;
    fac_inv[0]=fac_inv[1]=1;
    for(i=2;i<=NC-2;i++)
        fac_inv[i]=inv[i]*fac_inv[i-1]%MOD;
}
ll ncr(ll n,ll r)
{
    if(n<r || n==0) return 0;
    return (fac[n]*fac_inv[r]%MOD)*fac_inv[n-r]%MOD;
}

void solve()
{
    int n,m;cin>>n>>m;
    vector<vector<ll > >vec(m,vector<ll >(n));
    for(int i=0;i<n;i++)    for(int j=0;j<m;j++)cin>>vec[j][i];
    vector<pair<int , int > >pack[m];
    for(int i=0;i<m;i++)   { sort(vec[i].rbegin(),vec[i].rend());
        int cnt=0;
        int value_last=vec[i].back();
        while(vec[i].size()){
        cnt=0;
        while(vec[i].size() and vec[i].back() == value_last)
        {
            cnt++;
            vec[i].pop_back();
        }
        if(cnt){pack[i].push_back({cnt,value_last});}
        if(vec[i].size()){value_last=vec[i].back();}
        }
    }

    ll ans=0;
    for(int i=0;i<m;i++)
    {
        ll temp=1;
        int upto=0;
        for(int j=0;j<sz(pack[i]);j++)
        {
            temp = (temp * ((ncr(pack[i][j].second-1-upto,pack[i][j].first) * fac[pack[i][j].first])%MOD) )%MOD;
            upto += pack[i][j].first;
        }
        temp = ((fac[n]-temp)%MOD+MOD)%MOD;
        ans += temp;
    }
    ans = ((lll)ans*fac_inv[n])%MOD;
    cout<<ans<<edl;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
        IOS;  //comment it when in interactive
    int t=1;
    initialize();
//        cin>>t;
    while(t--){
        solve();}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/*

                                        * do smth instead of nothing and stay organized
*/



inline ll __gcd(ll a,ll b){if(a==0||b==0){return a+b;}ll tempa,tempb;while(1){if(a%b==0)return b;else{tempa=a;tempb=b;a=tempb;b=tempa%tempb;}}}
void pdash(int n){{for(int j=0;j<n;j++){cout<<"-";}cout<<edl;}}
ll power(ll x,ll y){ll result =1;while(y>0){if(y&1){result=(result*x);}y=y>>1;x=(x*x);}return result;}
ll power(ll x,ll y,ll z){ll result =1;x=x%z;while(y>0){if(y&1){result=(result*x)%z;}y=y>>1;x=(x*x)%z;}return result;}
ll modInverse(ll n,ll p){return power(n, p-2, p);}
ll nCrF(ll n,ll r,ll p){if(r==0)return 1;vector<ll>f(n+1);f[0]=1;for(ll i=1;i<=n;i++)f[i]=f[i-1]*i%p;
    return (f[n]*modInverse(f[r],p)%p*modInverse(f[n-r],p)%p)%p;}
vector<int > cordinate_compression(vector<int>& v){vector<int >p=v;make_uniquee(p);rl(i,sz(v))v[i]=(int)(lower_bound(all(p),v[i])-p.begin());return p;}
ll myrand(ll mod) {return rng()%mod;}
void make_uniquee(vector<int>& vec){sort(all(vec));vec.erase(unique(all(vec)),vec.end());}
int bitcount(ll u){int cnt=0;while(u){u=u&(u-1);cnt++;}return cnt;}
void svec(vector<int>& vec)
{cout<<"{\n";rl(i,sz(vec))cout<<"["<<i<<"]  = "<<vec[i]<<edl;cout<<"}\n";}
void sset(set<int>& st){cout<<"{\n";for(auto& j: st){cout<<j<<edl;}cout<<"}\n";}
void smap(map<int,int>& mp){cout<<"{\n";for(auto& j: mp)cout<<"["<<j.first<<"]  = "<<j.second<<edl;cout<<"}\n";}
