// Try Codeforces
// author: Leonardone @ NEETSDKASU
import std.algorithm  : sort, sum;
import std.array      : split, appender;
import std.conv       : to;
import std.stdio      : readln, writeln;
import std.string     : chomp;

auto gets() { return readln.chomp; }
auto getV(T)() { return gets.to!T; }
auto getVals(T)() { return gets.split.to!(T[]); }

long c(int n, int k) {
    long ret = 1;
    foreach (v; 0..k) {
        ret *= n - v;
        ret /= v + 1;
    }
    return ret;
}

void main() {
    auto s = getVals!int;
    auto n = s[0], m = s[1];
    auto cols = new int[m];
    long ans = n * m;
    foreach (_; 0..n) {
        auto rows = getVals!int;
        auto x = 0;
        foreach (i, v; rows) {
            if (v == 0) { continue; }
            cols[i]++;
            x++;
        }
        foreach (i; 1..x) {
            ans += c(x, i+1);
        }
        x = m - x;
        foreach (i; 1..x) {
            ans += c(x, i+1);
        }
    }
    foreach (v; cols) {
        auto x = v;
        foreach (i; 1..x) {
            ans += c(x, i+1);
        }
        x = n - x;
        foreach (i; 1..x) {
            ans += c(x, i+1);
        }
    }
    writeln(ans);
}