#include <bits/stdc++.h>
using namespace std;
int n, m;
long long mod;
int mapp[505][505];
int d[505];
long long dp1[1005][1005];
long long dp2[1005][1005];
int main(void) {
  scanf("%d%d%I64d", &n, &m, &mod);
  memset(mapp, 0, sizeof(mapp));
  memset(d, 0, sizeof(d));
  for (int i = 1; i <= m; i++) {
    char x[505];
    scanf("%s", x);
    for (int j = 0; j < n; j++) {
      mapp[i][j + 1] = x[j] - '0';
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (mapp[i][j] == 1) d[j]++;
    }
  }
  int q1 = 0, q2 = 0;
  for (int i = 1; i <= n; i++) {
    if (d[i] == 0)
      q2++;
    else if (d[i] == 1)
      q1++;
  }
  int sheng = (n - m) * 2;
  int flag = 1;
  memset(dp1, 0, sizeof(dp1));
  memset(dp2, 0, sizeof(dp2));
  dp1[q1][q2] = 1;
  for (int i = m + 1; i <= n; i++) {
    if (flag == 1) {
      for (int j = 2; j <= sheng; j++) {
        if ((sheng - j) % 2 == 0)
          dp2[j - 2][(sheng - j) / 2] =
              (dp2[j - 2][(sheng - j) / 2] +
               dp1[j][(sheng - j) / 2] * j * (j - 1) / 2 % mod) %
              mod;
      }
      for (int j = 1; j * 2 <= sheng; j++) {
        if (sheng - j * 2 > 0)
          dp2[sheng - j * 2][j - 1] =
              (dp2[sheng - j * 2][j - 1] +
               dp1[sheng - j * 2][j] * (sheng - j * 2) * j % mod) %
              mod;
      }
      for (int j = 2; j * 2 <= sheng; j++) {
        dp2[sheng - j * 2 + 2][j - 2] =
            (dp2[sheng - j * 2 + 2][j - 2] +
             dp1[sheng - j * 2][j] * j * (j - 1) / 2 % mod) %
            mod;
      }
      memset(dp1, 0, sizeof(dp1));
      flag = 1 - flag;
    } else if (flag == 0) {
      for (int j = 2; j <= sheng; j++) {
        if ((sheng - j) % 2 == 0)
          dp1[j - 2][(sheng - j) / 2] =
              (dp1[j - 2][(sheng - j) / 2] +
               dp2[j][(sheng - j) / 2] * j * (j - 1) / 2 % mod) %
              mod;
      }
      for (int j = 1; j * 2 <= sheng; j++) {
        if (sheng - j * 2 > 0)
          dp1[sheng - j * 2][j - 1] =
              (dp1[sheng - j * 2][j - 1] +
               dp2[sheng - j * 2][j] * (sheng - j * 2) * j % mod) %
              mod;
      }
      for (int j = 1; j * 2 <= sheng; j++) {
        dp1[sheng - j * 2 + 2][j - 2] =
            (dp1[sheng - j * 2 + 2][j - 2] +
             dp2[sheng - j * 2][j] * j * (j - 1) / 2 % mod) %
            mod;
      }
      memset(dp2, 0, sizeof(dp2));
      flag = 1 - flag;
    }
    sheng = sheng - 2;
  }
  printf("%d\n", max(dp1[0][0], dp2[0][0]));
  return 0;
}
