#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<bool>> tab(n, vector<bool>(m));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      int k;
      cin >> k;
      tab[i][j] = k == 1;
    }
  long long ans = 0;
  vector<int> countrow(n), countcol(m);
  for (int i = 0; i < n; i++) {
    int cur = 0;
    for (int j = 0; j < m; j++) {
      if (tab[i][j]) cur++;
    }
    countrow[i] = cur;
  }
  for (int i = 0; i < m; i++) {
    int cur = 0;
    for (int j = 0; j < n; j++) {
      if (tab[j][i]) cur++;
    }
    countcol[i] = cur;
  }
  for (int i : countrow) {
    if (i >= 2) ans += (1LL << i) - 1 - i;
    if (m - i >= 2) ans += (1LL << (m - i)) - 1 - (m - i);
  }
  for (int i : countcol) {
    if (i >= 2) ans += (1LL << i) - 1 - i;
    if (n - i >= 2) ans += (1LL << (n - i)) - 1 - (n - i);
  }
  ans += n * m;
  cout << ans << '\n';
  return 0;
}
