#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > grid(n);
  for (int i = 0; i < n; i++) {
    vector<int> temp(m);
    for (int j = 0; j < m; j++) {
      cin >> temp[j];
    }
    grid[i] = temp;
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    int ch = 0;
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == 1) {
        ch++;
      }
    }
    long long temp = pow(2, ch) - 1;
    res += temp;
  }
  for (int i = 0; i < m; i++) {
    int cv = 0;
    for (int j = 0; j < n; j++) {
      if (grid[j][i] == 1) {
        cv++;
      }
    }
    long long temp = pow(2, cv) - 1;
    res += temp;
  }
  for (int i = 0; i < n; i++) {
    int ch = 0;
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == 0) {
        ch++;
      }
    }
    long long temp = pow(2, ch) - 1;
    res += temp;
  }
  for (int i = 0; i < m; i++) {
    int cv = 0;
    for (int j = 0; j < n; j++) {
      if (grid[j][i] == 0) {
        cv++;
      }
    }
    long long temp = pow(2, cv) - 1;
    res += temp;
  }
  res = res - (n * m);
  cout << res;
}
