#include <bits/stdc++.h>
using namespace std;
int N, M, MDN;
int T1[501][501], T2[501][501];
int R[501];
char S[501];
int main() {
  scanf("%d%d%d", &N, &M, &MDN);
  for (int i = 0; i < M; ++i) {
    scanf("%s", S);
    for (int j = 0; j < N; ++j)
      if (S[j] == '1') ++R[j];
  }
  int v1 = 0, v2 = 0;
  for (int i = 0; i < N; ++i)
    if (!R[i])
      ++v2;
    else if (R[i] == 1)
      ++v1;
  int(*F)[501] = T1;
  int(*G)[501] = T2;
  G[v1][v2] = 1;
  for (int i = M; i < N; ++i) {
    memset(F, 0, sizeof(T1));
    for (int j2 = ((N + 1) >> 1) - i; j2 <= N - i; ++j2) {
      int j1 = (N - i - j2) << 1;
      if (j1 < 0 || j1 > N) continue;
      if (j1 && j2)
        F[j1][j2 - 1] =
            (int)(((long long)G[j1][j2] * j1 * j2 + F[j1][j2 - 1]) % MDN);
      if (j1 >= 2)
        F[j1 - 2][j2] =
            (int)(((long long)G[j1][j2] * j1 * (j1 - 1) / 2 + F[j1 - 2][j2]) %
                  MDN);
      if (j2 >= 2)
        F[j1 + 2][j2 - 2] = (int)(((long long)G[j1][j2] * j2 * (j2 - 1) / 2 +
                                   F[j1 + 2][j2 - 2]) %
                                  MDN);
    }
    int(*t)[501] = F;
    F = G;
    G = t;
  }
  printf("%d\n", G[0][0]);
  return 0;
}
