#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  unsigned long long n, m;
  unsigned long long ans = 0, o = 1;
  cin >> n >> m;
  int arr[n][m];
  for (int i = 0; i < n; i++) {
    unsigned long long c = 0;
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      c += arr[i][j];
    }
    ans += (o << c) - 1;
    ans += (o << (m - c)) - 1;
  }
  for (int i = 0; i < m; i++) {
    unsigned long long c = 0;
    for (int j = 0; j < n; j++) {
      c += arr[j][i];
    }
    ans += (o << c) - 1;
    ans += (o << (n - c)) - 1;
  }
  ans -= n * m;
  cout << ans;
  return 0;
}
