#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n][m];
  int count0 = 0, count1 = 0;
  long long int ans = 0;
  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++) {
    count0 = 0;
    count1 = 0;
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == 0) {
        count0 += 1;
      } else {
        count1 += 1;
      }
    }
    long long int y = 1;
    for (int r = 1; r <= count0; r++) {
      y = y * 2;
    }
    ans += y - 1;
    long long int s = 1;
    for (int r = 1; r <= count1; r++) {
      s = s * 2;
    }
    ans += s - 1;
  }
  for (int i = 0; i < m; i++) {
    count0 = 0;
    count1 = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j][i] == 0) {
        count0 += 1;
      } else {
        count1 += 1;
      }
    }
    long long int y = 1;
    for (int r = 1; r <= count0; r++) {
      y = y * 2;
    }
    ans += y - 1;
    long long int s = 1;
    for (int r = 1; r <= count1; r++) {
      s = s * 2;
    }
    ans += s - 1;
  }
  ans = ans - n * m;
  cout << ans << endl;
}
