#include <bits/stdc++.h>
using namespace std;
int a[55][55];
long long int ncr[55][55];
void f() {
  for (int i = 0; i < 55; i++) {
    ncr[i][0] = 1;
  }
  for (int i = 1; i <= 50; i++) {
    for (int j = 1; j <= i; j++) {
      ncr[i][j] = ncr[i - 1][j - 1] + ncr[i - 1][j];
    }
  }
  return;
}
int main() {
  int Case = 1;
  int n, m, k;
  char dump[2];
  f();
  while (scanf("%d %d", &n, &m) == 2) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        scanf("%d", &a[i][j]);
      }
    }
    long long int ans = n * m;
    for (int i = 0; i < n; i++) {
      int zeros = 0, ones = 0;
      for (int j = 0; j < m; j++) {
        if (a[i][j] == 0)
          zeros++;
        else
          ones++;
      }
      for (int j = 2; j <= zeros; j++) {
        ans += ncr[zeros][j];
      }
      for (int j = 2; j <= ones; j++) {
        ans += ncr[ones][j];
      }
    }
    for (int i = 0; i < m; i++) {
      int zeros = 0, ones = 0;
      for (int j = 0; j < n; j++) {
        if (a[j][i] == 0)
          zeros++;
        else
          ones++;
      }
      for (int j = 2; j <= zeros; j++) {
        ans += ncr[zeros][j];
      }
      for (int j = 2; j <= ones; j++) {
        ans += ncr[ones][j];
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
