#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x;
  long long res = 0, rows[55], cols[55];
  memset(rows, 0, sizeof(rows));
  memset(cols, 0, sizeof(cols));
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> x;
      rows[i] += x;
      cols[j] += x;
    }
  }
  for (int i = 0; i < n; i++) {
    res += (1LL << rows[i]) + (1LL << (m - rows[i])) - 2;
  }
  for (int i = 0; i < m; i++) {
    res += (1LL << cols[i]) + (1LL << (n - cols[i])) - 2 - n;
  }
  cout << res << "\n";
  return 0;
}
