#include <bits/stdc++.h>
using namespace std;
struct mone {
  int value = -1;
};
const int N = 2e5 + 5;
bool comp(int x, int y) { return x > y; }
bool is_square(long long int n) {
  if (pow((long long int)sqrt(n), 2) == n) return true;
  return false;
}
long long int logd(long long int x, long long int y) {
  return ceil((long double)log(x) / (long double)log(y));
}
long long int fact(long long int n) {
  if (n == 0) return 1;
  return n * fact(n - 1);
}
long long int power(long long int x, long long int y) {
  long long int ans = 1;
  while (y > 0) {
    if (y & 1) ans = ans * x;
    y = y >> 1;
    x *= x;
  }
  return ans;
}
long long int npr(long long int n, long long int r) {
  return fact(n) / fact(n - r);
}
long long int ncr(long long int n, long long int r) {
  return fact(n) / (fact(n - r) * fact(r));
}
long long int logof(long long int n, long long int p) {
  long long int ans = 0, x = 1;
  while (x <= n) ans++, x *= p;
  return --ans;
}
bool is_prime(long long int n) {
  long long int i = 2;
  while (i * i <= n) {
    if (n % i == 0) return false;
    i++;
  }
  return true;
}
void solve() {
  int n, m;
  cin >> n >> m;
  int a[n + 1][m + 1];
  unsigned long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    int o = 0, z = 0;
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 1)
        o++;
      else
        z++;
    }
    ans += power(2, o) - 1;
    ans += power(2, z) - 1;
  }
  for (int i = 1; i <= m; i++) {
    int o = 0, z = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j][i] == 1)
        o++;
      else
        z++;
    }
    ans += power(2, o) - 1;
    ans += power(2, z) - 1;
  }
  ans -= m * n;
  cout << ans << endl;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
}
