#include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(long long n, long long m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
vector<long long> g[N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  long long t, i, j, k, p, q, x, y, u, v, n, m;
  cin >> n >> m;
  long long a[n][m];
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) cin >> a[i][j];
  vector<long long> r(n, 0), c(m, 0);
  long long ans = 0;
  for (i = 0; i < n; i++) {
    x = 0;
    for (j = 0; j < m; j++) {
      x += a[i][j];
    }
    r[i] = x;
    ans += pow(2, x) - 1 + pow(2, m - x) - 1;
  }
  for (j = 0; j < m; j++) {
    x = 0;
    for (i = 0; i < n; i++) {
      x += a[i][j];
    }
    c[j] = x;
    ans += pow(2, x) - 1 - x + pow(2, n - x) - 1 - (n - x);
  }
  cout << ans;
  return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long)result * base) % mod;
    base = ((long long)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
void ipgraph(long long n, long long m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
}
void dfs(int u, int par) {
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
  }
}
