#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  bool a[n][m];
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    long long c0 = 0, c1 = 0;
    for (long long j = 0; j < m; ++j) {
      if (a[i][j]) {
        ++c1;
      } else {
        ++c0;
      }
    }
    ans = (ans + pow(2, c1) + pow(2, c0) - 2);
  }
  for (long long j = 0; j < m; ++j) {
    long long c0 = 0, c1 = 0;
    for (long long i = 0; i < n; ++i) {
      if (a[i][j]) {
        ++c1;
      } else {
        ++c0;
      }
    }
    ans = (ans + pow(2, c1) + pow(2, c0) - 2);
  }
  ans = (ans - n * m);
  cout << ans << "\n";
  return 0;
}
