#include <bits/stdc++.h>
using namespace std;
long long mp[666][666];
long long f(long long x, long long y) {
  long long s = 1;
  while (y) {
    if (y % 2) {
      s *= x;
    }
    x *= x;
    y /= 2;
  }
  return s;
}
signed main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) scanf("%lld", &mp[i][j]);
  long long ans = n * m;
  for (long long i = 1; i <= n; i++) {
    long long sum1 = 0;
    long long sum0 = 0;
    for (long long j = 1; j <= m; j++) {
      if (mp[i][j] == 1)
        sum1++;
      else
        sum0++;
    }
    if (sum1 >= 2) {
      ans += f(2, sum1) - 1 - sum1;
    }
    if (sum0 >= 2) {
      ans += f(2, sum0) - 1 - sum0;
    }
  }
  for (long long i = 1; i <= m; i++) {
    long long sum1 = 0;
    long long sum0 = 0;
    for (long long j = 1; j <= n; j++) {
      if (mp[j][i] == 1)
        sum1++;
      else
        sum0++;
    }
    if (sum1 >= 2) {
      ans += f(2, sum1) - 1 - sum1;
    }
    if (sum0 >= 2) {
      ans += f(2, sum0) - 1 - sum0;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
