#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const unsigned long long int LINF = 0x3f3f3f3f3f3f3f3fll;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
unsigned long long int eleva(unsigned long long int one,
                             unsigned long long int two) {
  unsigned long long int num = 1;
  while (two--) {
    num *= one;
  }
  return num;
}
int main() {
  unsigned long long int n, m, i, j, total, comp;
  scanf("%lld%lld", &n, &m);
  vector<unsigned long long int> rows(n, 0);
  vector<unsigned long long int> colu(m, 0);
  vector<vector<unsigned long long int> > matriz(
      n, vector<unsigned long long int>(m));
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%lld", &matriz[i][j]);
      rows[i] += matriz[i][j];
      colu[j] += matriz[i][j];
    }
  }
  total = 0;
  for (i = 0; i < n; i++) {
    total += (eleva(2, rows[i]) - 1) - rows[i];
    comp = m - rows[i];
    total += (eleva(2, comp) - 1) - comp;
  }
  for (i = 0; i < m; i++) {
    total += (eleva(2, colu[i]) - 1) - colu[i];
    comp = n - colu[i];
    total += (eleva(2, comp) - 1) - comp;
  }
  total += n * m;
  printf("%lld\n", total);
  return 0;
}
