#include <bits/stdc++.h>
using namespace std;
long long pow1(long long base, long long exp, long long mod = 1000000007) {
  base %= mod;
  long long ans = 1;
  while (exp) {
    if (exp & 1LL) ans = (ans * base) % mod;
    exp >>= 1LL, base = (base * base) % mod;
  }
  return ans;
}
long long logCeil(long long base, long long n) {
  long long i, x = 1;
  for (i = 0;; i++) {
    if (x >= n) break;
    x *= base;
  };
  return i;
}
long long dp[501][501];
map<pair<long long, pair<long long, long long> >, long long> cache;
long long ncr(long long n, long long r, long long mod) {
  if (n < r) return 0;
  return dp[n - r][r];
}
long long first(long long a, long long b, long long x, long long mod) {
  std::map<pair<long long, pair<long long, long long> >, long long>::iterator
      it = cache.find(make_pair(a, make_pair(b, x)));
  if (it != cache.end()) return it->second;
  long long ans = 0;
  if (a < 0 || b < 0 || x < 0 || 2 * a + b != 2 * x) return 0;
  if (x == 0) return 1;
  if (b == 2 && x == 1) return 1;
  if (x == 1 && a != 0) return 0;
  if (a == x) {
    if (a == 0) return 1;
    long long aa = 1;
    aa = (x * (x - 1)) / 2;
    aa %= mod;
    aa *= first(a - 2, 2, a - 1, mod);
    aa %= mod;
    return aa;
  }
  for (long long j = 0; j <= (b / 2); j++) {
    long long aa = 1;
    aa = ncr(x, b - 2 * j, mod);
    aa *= ncr(x - b + 2 * j, j, mod);
    aa %= mod;
    long long cnt = 0;
    if (b % 2 == 0)
      for (int i = b; i > 0; i -= 2) {
        if (cnt < j)
          aa *= (i / 2);
        else
          aa *= i;
        aa %= mod;
        aa *= i - 1;
        aa %= mod;
        cnt++;
      }
    else {
      aa *= b;
      aa %= mod;
      for (int i = b - 1; i > 0; i -= 2) {
        if (cnt < j)
          aa *= (i / 2);
        else
          aa *= i;
        aa %= mod;
        aa *= i - 1;
        aa %= mod;
        cnt++;
      }
    }
    aa *= first(x - b + j, b - 2 * j, a, mod);
    aa %= mod;
    ans += aa;
    ans %= mod;
  }
  cache[make_pair(a, make_pair(b, x))] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin.tie(0);
  ;
  for (int i = 0; i < 501; i++) dp[i][0] = 1, dp[0][i] = 1;
  long long n, m, mod;
  cin >> n >> m >> mod;
  for (int i = 1; i < 501; i++) {
    for (int j = 1; j < 501; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
      dp[i][j] %= mod;
    }
  }
  int a[m + 1][n + 1];
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      char temp;
      cin >> temp;
      a[i][j] = (int)(temp - '0');
    }
  }
  long long ans = 0, cnt = 0, cnt0 = 0;
  for (int i = 0; i < m; i++) {
    long long cc = 0;
    for (int j = 0; j < n; j++) {
      if (a[i][j] == 1) cc++;
    }
    if (cc != 2) ans = -1;
  }
  for (int i = 0; i < n; i++) {
    long long cc = 0;
    for (int j = 0; j < m; j++) {
      if (a[j][i] == 1) cc++;
    }
    if (cc > 2) ans = -1;
    if (cc == 1) cnt++;
    if (cc == 0) cnt0++;
  }
  if (ans == -1) {
    cout << 0;
    return 0;
  }
  cout << first(cnt0, cnt, n - m, mod);
}
