#include <bits/stdc++.h>
using namespace std;
long long row[60], col[60];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int a;
      cin >> a;
      row[i] += a;
      col[j] += a;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (row[i] > 0) ans += (1LL * 1 << (row[i])) - 1;
    if (m - row[i] > 0) ans += (1LL * 1 << (m - row[i])) - 1;
  }
  for (int i = 1; i <= m; i++) {
    if (col[i] > 0) ans += (1LL * 1 << (col[i])) - 1;
    if (n - col[i] > 0) ans += (1LL * 1 << (n - col[i])) - 1;
  }
  cout << ans - n * m << endl;
  return 0;
}
