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}
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define pi pair<int, int>

#ifdef int
  #undef int
#endif

template <int MOD_> struct modnum {
  static constexpr int MOD = MOD_;
  static_assert(MOD_ > 0, "MOD must be positive");
private:
  using ll = long long;
  int v;
  static int minv(int a, int m) {
    a %= m;
    assert(a);
    return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
  }
public:
  modnum() : v(0) {}
  modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
  explicit operator int() const { return v; }
  friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
  friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }
  friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
  friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }
  modnum inv() const {
    modnum res;
    res.v = minv(v, MOD);
    return res;
  }
  friend modnum inv(const modnum& m) { return m.inv(); }
  modnum neg() const {
    modnum res;
    res.v = v ? MOD-v : 0;
    return res;
  }
  friend modnum neg(const modnum& m) { return m.neg(); }
  modnum operator- () const {
    return neg();
  }
  modnum operator+ () const {
    return modnum(*this);
  }
  modnum& operator ++ () {
    v ++;
    if (v == MOD) v = 0;
    return *this;
  }
  modnum& operator -- () {
    if (v == 0) v = MOD;
    v --;
    return *this;
  }
  modnum& operator += (const modnum& o) {
    v += o.v;
    if (v >= MOD) v -= MOD;
    return *this;
  }
  modnum& operator -= (const modnum& o) {
    v -= o.v;
    if (v < 0) v += MOD;
    return *this;
  }
  modnum& operator *= (const modnum& o) {
    v = int(ll(v) * ll(o.v) % MOD);
    return *this;
  }
  modnum& operator /= (const modnum& o) {
    return *this *= o.inv();
  }
  friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
  friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
  friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
  friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
  friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
  friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
  friend string to_string (const modnum& a) { return to_string(int(a)); }
};

const int md = 998244353;

using Mint = modnum<md>;

vector<Mint> fact(1, 1);
vector<Mint> inv_fact(1, 1);

template<class T, class U>
T power(const T& a, const U& b) {
  assert(b >= 0);
  T x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}
 
Mint C(int n, int k) {
  if (k < 0 || k > n) {
    return 0;
  }
  while ((int) fact.size() < n + 1) {
    fact.push_back(fact.back() * (int) fact.size());
    inv_fact.push_back(1 / fact.back());
  }
  return fact[n] * inv_fact[k] * inv_fact[n - k];
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> d(m, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> d[j][i];
    }
  }
  Mint ans = 0;
  Mint f = 1;
  for (int i = 1; i <= n; i++) {
    f *= i;
  }
  for (vector<int> dd : d) {
    // we want to count the number of permutation of [1 ... n]
    // in which given point is included
    // there are total f = n! permutations
    // 
    // we sort the cities by distance from given point
    // in non-decreasing order
    // let it be [v1, v2, ..., vn] with distances
    //           [d1, d2, ..., dn] (non-decreasing)
    // lets count the number of permutation for which given point is not included
    
    sort(all(dd));
    Mint cur = 1; // number of permutation which don't include given point
    for (int i = 1; i <= n; i++) {
      cur *= max(0, dd[i - 1] - i);
      // if (dd[i - 1] - i) achives a non-positive value for any i
      // then we assert that given point is contained in every permutation
      // 
      // proof: suppose for some i, (dd[i - 1] - i) is non-positive
      // let the corresponding city for this i be v
      // this means the permuations for which city v occurs at or after position i
      // the given point will be included in those permuation
      // 
      // also if we put city v at position < i, then some other city whose 
      // distance is less than that of v will be assigned position greater or equal to i
      // and again we can take this given point
      // hence every permuation will then include the given point
    }
    ans += f - cur;
  }
  cout << ans / f << "\n";
  return 0;
}