#include <bits/stdc++.h>
int n, m, a[55][55], row[55], col[55];
long long fac[55];
using namespace std;
int main() {
  fac[0] = 1;
  for (int i = 1; i < 55; ++i) fac[i] = fac[i - 1] << 1;
  while (~scanf("%d%d", &n, &m)) {
    int one = 0;
    memset(row, 0, sizeof(row));
    memset(col, 0, sizeof(col));
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) {
        scanf("%d", &a[i][j]);
        row[i] += a[i][j];
        col[j] += a[i][j];
        one += a[i][j];
      }
    long long ans = -n * m;
    for (int i = 0; i < n; ++i) {
      ans += fac[row[i]] + fac[m - row[i]] - 2;
    }
    for (int i = 0; i < m; ++i) {
      ans += fac[col[i]] + fac[n - col[i]] - 2;
    }
    printf("%lld\n", ans);
  }
  return 0;
}
