#include <bits/stdc++.h>
using namespace std;
const int MAX = 51;
int main() {
  int n, m;
  int i, j, k;
  long long pow2[MAX];
  long long arr[MAX][MAX];
  long long res = 0;
  int zeros, ones;
  pow2[0] = 1;
  for (i = 1; i < MAX; i++) {
    pow2[i] = pow2[i - 1] * 2;
  }
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    zeros = ones = 0;
    for (j = 0; j < m; j++) {
      cin >> k;
      arr[i][j] = k;
      if (k)
        ones++;
      else
        zeros++;
    }
    res += pow2[ones] + pow2[zeros] - 2;
  }
  for (j = 0; j < m; j++) {
    zeros = ones = 0;
    for (i = 0; i < n; i++) {
      if (arr[i][j])
        ones++;
      else
        zeros++;
    }
    res += pow2[ones] + pow2[zeros] - 2;
  }
  res -= (n * m);
  cout << res << endl;
}
