#include <bits/stdc++.h>
using namespace std;
int n, m, ans, zeros, ones, twos, M, c[501], dp[2][501][501];
char a[501][501];
inline void add(int& a, int b) {
  a += b;
  if (a >= M) a -= M;
}
int main() {
  scanf("%d%d%d", &n, &m, &M);
  for (int i = 0; i < m && scanf("%s", &a[i]); i++) {
    int x = 0;
    for (int j = 0; j < n; j++) {
      c[j] += (a[i][j] == '1');
      x += (a[i][j] == '1');
      if (c[j] > 2) ans = -1;
    }
    if (x != 2) ans = -1;
  }
  if (ans == -1) {
    printf("0");
    return 0;
  }
  if (m == n) {
    printf("1");
    return 0;
  }
  m = n - m;
  for (int i = 0; i < n; i++)
    if (c[i] == 1)
      ones++;
    else if (c[i] == 2)
      zeros++;
  twos = n - ones - zeros;
  for (int i = 1; i <= m; i++)
    for (int k = 0; k <= twos; k++)
      for (int j = 0; j <= n - k; j++) {
        if (i == 1) {
          if (j == 2 && !k) dp[1][j][k] = 1;
          continue;
        }
        if (j >= 2 && dp[!(i & 1)][j - 2][k])
          add(dp[i & 1][j][k],
              (1LL * j * (j - 1) * dp[!(i & 1)][j - 2][k] / 2) % M);
        if (k >= 1 && dp[!(i & 1)][j][k - 1])
          add(dp[i & 1][j][k], (1LL * j * k * dp[!(i & 1)][j][k - 1]) % M);
        if (j + 2 <= n && k >= 2 && dp[!(i & 1)][j + 2][k - 2])
          add(dp[i & 1][j][k],
              (1LL * k * (k - 1) * dp[!(i & 1)][j + 2][k - 2] / 2) % M);
      }
  printf("%d", dp[m & 1][ones][twos]);
  return 0;
}
