#include <bits/stdc++.h>
using namespace std;
unsigned long long n, m, ans;
unsigned long long arr[55][55];
template <typename T>
T power(T base, T exp) {
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base);
    base = (base * base);
    exp >>= 1;
  }
  return result;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> arr[i][j];
  for (int i = 0; i < n; ++i) {
    unsigned long long cnt = 0, cnt2 = 0;
    for (int j = 0; j < m; ++j) cnt += (arr[i][j] > 0);
    cnt2 = m - cnt;
    if (cnt) ans += power((unsigned long long)2, cnt) - 1;
    if (cnt2) ans += power((unsigned long long)2, cnt2) - 1;
  }
  for (int j = 0; j < m; ++j) {
    unsigned long long cnt = 0, cnt2 = 0;
    for (int i = 0; i < n; ++i) cnt += (arr[i][j] > 0);
    cnt2 = n - cnt;
    if (cnt > 1) ans += power((unsigned long long)2, cnt) - 1 - cnt;
    if (cnt2 > 1) ans += power((unsigned long long)2, cnt2) - 1 - cnt2;
  }
  cout << ans << endl;
  return 0;
}
