#include <bits/stdc++.h>
using namespace std;
int a[60][60];
int a1[60], a0[60], b1[60], b0[60];
long long anss[100];
int main() {
  anss[0] = 1;
  anss[1] = 2;
  anss[2] = 4;
  for (int i = 3; i <= 50; i++) {
    anss[i] = anss[i - 1] * 2;
  }
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 1) a1[i]++;
      if (a[i][j] == 0) a0[i]++;
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j][i] == 1) b1[i]++;
      if (a[j][i] == 0) b0[i]++;
    }
  }
  long long int ans = n * m;
  for (int i = 0; i < n; i++) {
    ans += (anss[a1[i]] - 1 - a1[i]);
    ans += (anss[a0[i]] - 1 - a0[i]);
  }
  for (int j = 0; j < m; j++) {
    ans += (anss[b1[j]] - 1 - b1[j]);
    ans += (anss[b0[j]] - 1 - b0[j]);
  }
  cout << ans << endl;
}
