#include <bits/stdc++.h>
using namespace std;
const int maxn = 55, inf = 0x3f3f3f3f;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
const long double pi = acos(-1.0L);
int a[maxn][maxn];
long long p[maxn];
int main() {
  int n, m, i, j, sum = 0;
  long long ans = 0;
  scanf("%d%d", &n, &m);
  p[0] = 1;
  for (i = 1; i <= 52; i++) {
    p[i] = p[i - 1] * 2;
    p[i - 1]--;
  }
  for (i = 1; i <= n; i++) {
    sum = 0;
    for (j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
      sum += a[i][j];
    }
    ans += p[sum] + p[m - sum];
  }
  for (i = 1; i <= m; i++) {
    sum = 0;
    for (j = 1; j <= n; j++) {
      sum += a[j][i];
    }
    ans += p[sum] + p[n - sum] - n;
  }
  cout << ans;
  return 0;
}
