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