#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long rw[55], cw[55], ans = 0;
long long myPow(long long a, long long b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    long long temp = myPow(a, b / 2);
    return temp * temp;
  } else {
    long long temp = myPow(a, (b - 1) / 2);
    return a * temp * temp;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      long long temp;
      cin >> temp;
      if (temp == 1) {
        rw[i] += 1;
        cw[j] += 1;
      }
    }
  }
  ans += n * m;
  for (long long i = 1; i <= n; i++) {
    ans += myPow(2ll, rw[i]) - 1;
    ans += myPow(2ll, m - rw[i]) - 1;
    ans -= m;
  }
  for (long long i = 1; i <= m; i++) {
    ans += myPow(2ll, cw[i]) - 1;
    ans += myPow(2ll, n - cw[i]) - 1;
    ans -= n;
  }
  cout << ans << endl;
}
