#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(const T &x) {
  return x * x;
}
inline long long sqr(int x) { return sqr<long long>(x); }
template <class T>
T binpow(const T &a, long long n) {
  return n == 0 ? 1 : sqr(binpow(a, n / 2)) * (n % 2 ? a : 1);
}
long long binpow(long long a, long long n, long long modulo) {
  return n == 0 ? 1
                : sqr(binpow(a, n / 2, modulo)) % modulo * (n % 2 ? a : 1) %
                      modulo;
}
long long gcd(long long a, long long b, long long &x, long long &y);
inline long long gcd(long long a, long long b) { return gcd(a, b, a, b); }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main(int argc, const char *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  srand((unsigned int)time(NULL));
  int n, m;
  while (cin >> n >> m) {
    vector<vector<int> > colour(n, vector<int>(m));
    for (int i = (0); i < (n); ++i) {
      for (int j = (0); j < (m); ++j) {
        cin >> colour[i][j];
      }
    }
    long long answer = 0;
    for (int i = (0); i < (n); ++i) {
      int ones = 0;
      for (int j = (0); j < (m); ++j) {
        ones += colour[i][j];
      }
      int zeros = m - ones;
      answer += ((1LL << ones) - 1LL) + ((1LL << zeros) - 1LL);
    }
    for (int j = (0); j < (m); ++j) {
      int ones = 0;
      for (int i = (0); i < (n); ++i) {
        ones += colour[i][j];
      }
      int zeros = n - ones;
      answer += ((1LL << ones) - 1LL) + ((1LL << zeros) - 1LL);
    }
    answer -= n * m;
    cout << answer << endl;
  }
  return 0;
}
long long gcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
