#include <bits/stdc++.h>
using namespace std;
const long long int big = 10e7 + 11;
vector<long long int> Pow;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int x = 2;
  unsigned long long int ans = 0;
  Pow.push_back(0);
  for (int i = 0; i <= 52; i++) {
    Pow.push_back(x - 1);
    x *= 2;
  }
  int n, m;
  cin >> n >> m;
  vector<int> v[n + 2];
  for (int i = 0; i < n; i++) {
    int one = 0, z = 0;
    for (int j = 0; j < m; j++) {
      int x;
      cin >> x;
      v[i].push_back(x);
      if (x) one++;
    }
    z = m - one;
    ans += (Pow[one] + Pow[z]);
  }
  for (int i = 0; i < m; i++) {
    int one = 0, z = 0;
    for (int j = 0; j < n; j++) {
      int x;
      x = v[j][i];
      if (x) one++;
    }
    z = n - one;
    ans += (Pow[one] + Pow[z]);
  }
  cout << ans - (n * m) << "\n";
  return 0;
}
