#include <bits/stdc++.h>
using namespace std;
bool isprime(int n) {
  for (int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return 0;
  return 1;
}
void stadIbO() {
  freopen("palindrome.in", "r", stdin);
  freopen("palindrome.out", "w", stdout);
}
void weza() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int arr1[50 + 1];
int arr2[50 + 1];
int main() {
  weza();
  long long n, m, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int a;
      cin >> a;
      if (a) {
        arr2[i]++;
        arr1[j]++;
      }
    }
  }
  for (int i = 0; i < n; i++)
    sum += pow(2, arr2[i]) - arr2[i] - 1 + pow(2, (m - arr2[i])) -
           (m - arr2[i]) - 1;
  for (int i = 0; i < m; i++)
    sum += pow(2, arr1[i]) - arr1[i] - 1 + pow(2, (n - arr1[i])) -
           (n - arr1[i]) - 1;
  cout << sum + m * n;
  return 0;
}
