#include <iostream>
#include <algorithm>
#include <vector>

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 998244353;
using mint = ModInt<MOD>;

void bool_elimination(std::vector<std::vector<int>>& mat) {
    int n = mat.size(), m = mat.front().size();

    for (int l = 0; l < n; ++l) {
        {
            auto& v = *std::max_element(mat.begin() + l, mat.end());
            std::swap(v, mat[l]);
        }

        const auto& v = mat[l];
        for (int i = l + 1; i < n; ++i) {
            auto u = mat[i];
            for (int j = 0; j < m; ++j) u[j] ^= v[j];
            if (u < mat[i]) std::swap(u, mat[i]);
        }
    }
}

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

void solve() {
    int n, m;
    std::cin >> n >> m;

    auto mat = vec(n, vec(m, 0));
    for (auto& v : mat) {
        for (auto& x : v) {
            std::cin >> x;
        }
    }
    bool_elimination(mat);

    int r = std::count_if(mat.begin(), mat.end(),
                          [](const auto& v) {
                              return any_of(v.begin(), v.end(), [](auto x) { return x; });
                          });

    std::vector<mint> dp{1, 0};
    for (int i = 0; i < r; ++i) {
        std::vector<mint> ndp(2);
        for (int j = 0; j < 2; ++j) {
            ndp[j] = dp[j] * 3 + dp[1 - j];
        }
        std::swap(dp, ndp);
    }

    mint ans = dp[1];
    std::cout << ans * mint(2).pow(n + m - r * 2) << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


Measured memory_bytes: 640