#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long mat[1000][1000];
long long dp[100][100];
long long paskal(long long a, long long b) {
  if (a == b) return 1;
  if (a == 0 || b == 0) return 1;
  if (dp[a][b] != 0) return dp[a][b];
  return dp[a][b] = paskal(a - 1, b - 1) + paskal(a - 1, b);
}
int main() {
  scanf("%d%d", &n, &m);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      scanf("%d", &mat[i][j]);
    }
  }
  long long resenje = n * m;
  for (long long i = 0; i < n; i++) {
    long long br0 = 0, br1 = 0;
    for (long long j = 0; j < m; j++)
      if (mat[i][j] == 1)
        br1++;
      else
        br0++;
    for (long long k = 2; k <= br1; k++) {
      resenje += paskal(br1, k);
    }
    for (long long k = 2; k <= br0; k++) resenje += paskal(br0, k);
  }
  for (long long j = 0; j < m; j++) {
    long long br0 = 0, br1 = 0;
    for (long long i = 0; i < n; i++)
      if (mat[i][j] == 1)
        br1++;
      else
        br0++;
    for (long long k = 2; k <= br1; k++) {
      resenje += paskal(br1, k);
    }
    for (long long k = 2; k <= br0; k++) resenje += paskal(br0, k);
  }
  cout << resenje << endl;
  return 0;
}
