#include <bits/stdc++.h>
int main() {
  int n, m, i, j, aux;
  long long soma;
  scanf("%d%d", &n, &m);
  int numeros[n][m];
  soma = 0;
  for (i = 0; i < n; i++) {
    aux = 0;
    for (j = 0; j < m; j++) {
      scanf("%d", &numeros[i][j]);
      if (numeros[i][j] == 1) {
        aux++;
      }
    }
    soma += (1ll << aux) - 1 + (1ll << (m - aux)) - 1;
  }
  for (j = 0; j < m; j++) {
    aux = 0;
    for (i = 0; i < n; i++) {
      if (numeros[i][j] == 1) {
        aux++;
      }
    }
    soma += (1ll << aux) - 1 + (1ll << (n - aux)) - 1;
  }
  soma -= m * n;
  printf("%lld", soma);
  return 0;
}
