#include <bits/stdc++.h>
using namespace std;
long long v[55], h[55];
unsigned long long f(unsigned long long a) {
  unsigned long long res = 0, i;
  for (i = 1; i <= a; i++) {
    double s = 1;
    for (int j = i + 1; j <= a; j++) {
      s *= j;
      s /= (j - i);
    }
    res += (long long)s;
  }
  return res;
}
int main() {
  long long n, m, i, j, k, l, a, c, b;
  unsigned long long res = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a;
      v[i] += a;
      h[j] += a;
    }
  }
  for (i = 0; i < n; i++) {
    res += f(v[i]);
    res += f(m - v[i]);
  }
  for (i = 0; i < m; i++) {
    res += f(h[i]) + f(n - h[i]);
  }
  cout << res - n * m;
  return 0;
}
