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

x_array = [0,1].repeated_permutation(n).to_a.map{|ele| ele.size.times.select{|i| 1 == ele[i]}}
y_array = [0,1].repeated_permutation(m).to_a.map{|ele| ele.size.times.select{|i| 1 == ele[i]}}
combi = x_array.product(y_array)
count = 0
combi.each do |pair|
  judge = false
  pair[0].each do |x|
    pair[1].each do |y|
     judge =  judge == true ? false : true if table[x][y] == 1
    end
  end
  count += 1 if judge == true
end

puts count % 998244353