#include <bits/stdc++.h>
using namespace std;
long long int x, y;
long long int gcd(long long int a, long long int b) {
  if (a == 0) {
    x = 0, y = 1;
    return b;
  }
  long long int gc = gcd(b % a, a);
  long long int temp;
  temp = x;
  x = y - (b / a) * temp;
  y = temp;
  return gc;
}
long long int pow(long long int a, long long int x, long long int m) {
  long long int ans = 1, k = 1;
  while (k <= x) {
    if (x % k) ans = ((ans * a) % m);
    k <<= 1;
    a *= a;
    a %= m;
  }
  return ans;
}
int a[55][55];
int r[55];
int c[55];
long long int p2[55];
int main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int i, j, n, m;
  cin >> n >> m;
  p2[0] = 1;
  for (i = 1; i <= 50; i++) {
    p2[i] = p2[i - 1] * 2;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
      r[i] += a[i][j];
      c[j] += a[i][j];
    }
  }
  long long int ans = n * m;
  for (i = 0; i < n; i++) {
    if (r[i] >= 2) {
      ans += p2[r[i]] - r[i] - 1;
    }
    r[i] = m - r[i];
    if ((r[i]) >= 2) {
      ans += p2[r[i]] - r[i] - 1;
    }
  }
  for (i = 0; i < m; i++) {
    if (c[i] >= 2) {
      ans += p2[c[i]] - c[i] - 1;
    }
    c[i] = n - c[i];
    if ((c[i]) >= 2) {
      ans += p2[c[i]] - c[i] - 1;
    }
  }
  cout << ans;
}
