#include <bits/stdc++.h>
using namespace std;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
void GO_GO_GO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void BYE_BYE() {
  cerr << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}
long long int primeArr[1000001];
long long int binpow(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans *= a;
    }
    b >>= 1;
    a *= a;
  }
  return ans;
}
int main() {
  GO_GO_GO();
  long long int t = 1;
  while (t--) {
    long long int i = 0;
    long long int j = 0;
    long long int n, m;
    cin >> n >> m;
    vector<vector<long long int>> v(n, vector<long long int>(m));
    vector<long long int> row(n), col(m);
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        cin >> v[i][j];
      }
    }
    for (i = 0; i < n; i++) {
      long long int sum = 0;
      for (j = 0; j < m; j++) {
        sum += v[i][j];
      }
      row[i] = sum;
    }
    for (j = 0; j < m; j++) {
      long long int sum = 0;
      for (i = 0; i < n; i++) {
        sum += v[i][j];
      }
      col[j] = sum;
    }
    long long int ans = 0;
    for (i = 0; i < n; i++) {
      ans += binpow(2, row[i]) - 1;
      ans += binpow(2, m - row[i]) - 1;
    }
    for (i = 0; i < m; i++) {
      ans += binpow(2, col[i]) - 1;
      ans += binpow(2, n - col[i]) - 1;
    }
    ans -= n * m;
    cout << ans << "\n";
  }
  BYE_BYE();
  return 0;
}
