#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

template<int mod=MOD>
struct ModRing {
   int x;
   ModRing() = default;
   ModRing(int a) { x = ((a % mod) + mod) % mod; }

   const ModRing operator+() const { return ModRing(x); }
   const ModRing operator-() const { return ModRing((-x + mod) % mod); }

   ModRing& operator+=(const ModRing& a) { (x += a.x) %= mod; return *this; }
   ModRing& operator-=(const ModRing& a) { return *this += -a; }
   ModRing& operator*=(const ModRing& a) { (x *= a.x) %= mod; return *this; }

   ModRing& operator++() { return *this += 1; }
   ModRing& operator--() { return *this -= 1; }

   const ModRing operator+(const ModRing& a) const { return ModRing(*this) += a; }
   const ModRing operator-(const ModRing& a) const { return ModRing(*this) -= a; }
   const ModRing operator*(const ModRing& a) const { return ModRing(*this) *= a; }

   bool operator<(const ModRing& a) const { return x < a.x; }
   bool operator>(const ModRing& a) const { return a < *this; }
   bool operator<=(const ModRing& a) const { return !(*this > a); }
   bool operator>=(const ModRing& a) const { return !(*this < a); }
   bool operator==(const ModRing& a) const { return !(*this < a) && !(*this > a); }
   bool operator!=(const ModRing& a) const { return !(*this == a); }

   const ModRing power(int n) const {
      ModRing tmp = x, res = 1;
      while (n > 0) { if ((n & 1) == 1) res *= tmp; tmp *= tmp; n >>= 1; }
      return res;
   }
};

template<int mod>auto&operator<<(ostream&s,const ModRing<mod>&a){s<<a.x;return s;}

template<int mod=MOD>
struct FiniteField : ModRing<mod> {
   FiniteField() = default;
   FiniteField(int a) : ModRing<mod>(a) {}
   FiniteField(const ModRing<mod>& a) : ModRing<mod>(a) {}

   FiniteField inverse() const {
      try { if (this->x == 0) throw "0 have no inverse"; }
      catch (const char* e) { cerr << e << endl; }
      return ModRing<mod>::power(mod-2);
   }
   FiniteField& operator/=(const FiniteField& a) { return *this = (*this *= a.inverse()); }
   const FiniteField operator/(const FiniteField& a) const { return FiniteField(*this) /= a; }
};


template<typename Field>
struct Matrix
{
   vector<vector<Field>> val;
   int m, n;

   Matrix() = default;
   Matrix(int a, int b) : m(a), n(b) {
      val.resize(m, vector<Field>(n));
   }
   Matrix(const vector<vector<Field>>& vec) { init(vec); }
   void init(const vector<vector<Field>>& vec) {
      m = vec.size(); n = vec[0].size();
      val.resize(m, vector<Field>(n));
      for (int i = 0; i < m; i++) for (int j = 0; j < n; j++)
         val[i][j] = vec[i][j];
   }

   Matrix& operator=(const Matrix& mat) {
      try { if (m != mat.m || n != mat.n) throw "Matrix can't be substituted"; }
      catch (const char* e) { cerr << e << endl; }
      for (int i = 0; i < m; i++) for (int j = 0; j < n; j++)
         val[i][j] = mat.val[i][j];
      return *this;
   }

   Field& operator()(int i, int j) {
      try { if (i < 0 || m <= i || j < 0 || n <= j) throw "Bad access"; }
      catch (const char* e) { cerr << e << endl; }
      return val[i][j];
   }
   const Field operator()(int i, int j) const {
      try { if (i < 0 || m <= i || j < 0 || n <= j) throw "Bad access"; }
      catch (const char* e) { cerr << e << endl; }
      return val[i][j];
   }

   Matrix& operator-() const {
      Matrix tmp(m, n);
      for (int i = 0; i < m; i++) for (int j = 0; j < n; j++)
         tmp.val[i][j] = -val[i][j];
      return tmp;
   }

   Matrix& operator+=(const Matrix& mat) {
      try { if (m != mat.m || n != mat.n) throw "Matrix can't be added"; }
      catch (const char* e) { cerr << e << endl; }
      for (int i = 0; i < m; i++) for (int j = 0; j < n; j++)
         val[i][j] += mat.val[i][j];
      return *this;
   }
   Matrix& operator-=(const Matrix& mat) {
      try { if (m != mat.m || n != mat.n) throw "Matrix can't be subtracted"; }
      catch (const char* e) { cerr << e << endl; }
      return *this += -mat;
   }
   Matrix operator*=(const Matrix& mat) {
      try { if (n != mat.m) throw "Matrix can't be producted"; }
      catch (const char* e) { cerr << e << endl; }
      Matrix tmp(m, mat.n);
      for (int i = 0; i < m; i++) for (int j = 0; j < mat.n; j++) for (int k = 0; k < n; k++)
         tmp.val[i][j] += val[i][k] * mat.val[k][j];
      n = mat.n;
      val.resize(m, vector<Field>(n));
      return *this = tmp;
   }

   const Matrix operator+(const Matrix& mat) const { return Matrix(*this) += mat; }
   const Matrix operator-(const Matrix& mat) const { return Matrix(*this) -= mat; }
   const Matrix operator*(const Matrix& mat) const { return Matrix(*this) *= mat; }

   Matrix transpose() const {
      Matrix tmp(n, m);
      for (int i = 0; i < m; i++) for (int j = 0; j < n; j++)
         tmp.val[j][i] = val[i][j];
      return tmp;
   }

   int gaussElimination() {
      int swap_num = 0;
      int col = 0;
      for (int i = 0; i < m; i++) {
         int pivot;
         bool updated = false;
         while (col < n) {
            for (int j = i; j < m; j++) if (val[j][col] != 0) {
               pivot = j;
               updated = true;
               break;
            }
            if (updated) break;
            col++;
         }
         if (!updated) return swap_num;

         if (i != pivot) {
            swap(val[i], val[pivot]);
            swap_num++;
         }
         for (int j = i+1; j < m; j++) {
            Field ratio = val[j][col] / val[i][col];
            for (int k = col; k < n; k++) val[j][k] -= val[i][k] * ratio;
         }
         col++;
      }
      return swap_num;
   }

   int rank() const {
      Matrix A(val);
      A.gaussElimination();
      int j = 0;
      for (int i = 0; i < m; i++) {
         while (A.val[i][j] == 0) {
            j++; if (j == n) return i;
         }
      }
      return m;
   }
};
template<typename Field>ostream&operator<<(ostream&s,const Matrix<Field>&mat){s<<endl<<"[";for(int i=0;i<mat.m;i++){s<<"[";for(int j=0;j<mat.n;j++){s<<mat(i,j);if(j<mat.n-1)s<<" ";}s<<"]";if(i<mat.m-1)s<<endl;}s<<"]";return s;}

template<typename Field>
struct SquareMatrix : Matrix<Field>
{
   int num;
   SquareMatrix(int a=0) : Matrix<Field>(a, a) { num = a; }
   SquareMatrix(const vector<vector<Field>>& vec) : num(vec.size()), Matrix<Field>(vec) {
      try { if (vec.size() != vec[0].size()) throw "Matrix isn't square matrix"; }
      catch (const char* e) { cerr << e << endl; }
   }

   Field determinant() const {
      SquareMatrix A(*this);
      int swap_num = A.gaussElimination();
      Field det = (swap_num % 2 ? -1 : 1);
      for (int i = 0; i < num; i++) det *= A(i,i);
      return det;
   }

   SquareMatrix power(int n) const {
      SquareMatrix A(*this);
      vector<vector<Field>> E(num,vector<Field>(num));
      for (int i = 0; i < num; i++) E[i][i] = 1;
      SquareMatrix res(E);
      while (n > 0) { if ((n & 1) == 1) res *= A; A *= A; n >>= 1; }
      return res;
   }
};

signed main()
{
   int n, m; cin >> n >> m;

   using GF2 = FiniteField<2>;
   V<V<GF2>> a(n, V<GF2>(m));
   for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
         int v; cin >> v;
         a[i][j] = v;
      }
   }

   Matrix<GF2> A(a);

   int rank = A.rank();

   using GF = FiniteField<998244353>;
   GF ans = GF(2).power(n+m-1) - GF(2).power(n+m-rank-1);
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 2432