n,m = gets.split.map(&:to_i)
table = []
(1..n).each do |i|
  table.push(gets.split.map(&:to_i))
end

count = 0
if n < m
  (0..(n - 1)).each do |x|
    judge = false
    (0..(m - 1)).each do |y|
      if table[x][y] == 1
        judge = true
        break
      end
    end
    count += 1 if judge == false
  end
  puts ((((2 ** n) % 998244353) - ((2 ** count)) % 998244353) * ((2 ** (m - 1))% 998244353) % 998244353
else
  (0..(m - 1)).each do |y|
    judge = false
    (0..(n - 1)).each do |x|
      if table[x][y] == 1
        judge = true
        break
      end
    end
    count += 1 if judge == false
  end
  puts ((((2 ** m) % 998244353) - ((2 ** count)) % 998244353) * ((2 ** (n - 1))% 998244353) % 998244353
end