#include <bits/stdc++.h>
using namespace std;
long long a[51][51];
long long combinatorics(long long n, long long k) {
  double res = 1;
  for (long long i = 1; i <= k; ++i) res = res * (n - k + i) / i;
  return (long long)(res + 0.01);
}
int main() {
  long long n, m, i, j, numOneRow[51] = {0}, numZeroRow[51] = {0},
                        numOneColumn[51] = {0}, numZeroColumn[51] = {0}, x, y;
  long long c;
  cin >> n >> m;
  c = m * n;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 0) {
        numZeroRow[i]++, numZeroColumn[j]++;
      } else {
        numOneRow[i]++, numOneColumn[j]++;
      }
    }
  }
  for (i = 0; i < n; i++) {
    j = 2;
    x = numOneRow[i], y = numZeroRow[i];
    while (x >= j) {
      c += combinatorics(x, j);
      j++;
    }
    j = 2;
    while (y >= j) {
      c += combinatorics(y, j);
      j++;
    }
  }
  for (j = 0; j < m; j++) {
    i = 2;
    x = numOneColumn[j], y = numZeroColumn[j];
    while (x >= i) {
      c += combinatorics(x, i);
      i++;
    }
    i = 2;
    while (y >= i) {
      c += combinatorics(y, i);
      i++;
    }
  }
  cout << c << endl;
  return 0;
}
