#include <bits/stdc++.h>
using namespace std;
struct IntCmp {
  bool operator()(const std::pair<std::string, int> &lhs,
                  const std::pair<std::string, int> &rhs) {
    return lhs.second > rhs.second;
  }
};
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long sets(long long i) { return pow(2, i) - 1; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, cnt = 0, ans = 0;
  cin >> n >> m;
  long long a[n][m];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) cin >> a[i][j];
  }
  for (long long int i = 0; i < n; i++) {
    cnt = 0;
    for (long long int j = 0; j < m; j++) {
      if (a[i][j] == 0) cnt++;
    }
    ans += (sets(cnt) + sets(m - cnt));
  }
  for (long long int i = 0; i < m; i++) {
    cnt = 0;
    for (long long int j = 0; j < n; j++) {
      if (a[j][i] == 0) cnt++;
    }
    ans += (sets(cnt) + sets(n - cnt));
  }
  ans -= (n * m);
  cout << ans;
  return 0;
}
