#include <bits/stdc++.h>
using namespace std;
int cnt[506];
int dp[506][506];
char str[506];
struct ll {
  int x, y;
} Q[506 * 506 * 2];
int main() {
  memset(dp, -1, sizeof(dp));
  int n, m, P;
  scanf("%d%d%d", &n, &m, &P);
  if (n == 2) {
    puts("1");
    return 0;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%s", str + 1);
    int num = 0;
    for (int j = 1; j <= n; j++)
      if (str[j] == '1') cnt[j]++, num++;
    if (num != 2) {
      puts("0");
      return 0;
    }
  }
  int num1 = 0, num2 = 0;
  for (int i = 1; i <= n; i++)
    if (cnt[i] < 2) {
      if (cnt[i] == 0)
        num2++;
      else
        num1++;
    } else if (cnt[i] > 2) {
      puts("0");
      return 0;
    }
  dp[num1][num2] = 1;
  int l = 0, r = 1;
  Q[1] = {num1, num2};
  while (l < r) {
    ll t = Q[++l];
    int j = t.x, k = t.y;
    if (j && k) {
      if (dp[j][k - 1] == -1) Q[++r] = {j, k - 1};
      dp[j][k - 1] = dp[j][k - 1] < 0 ? 0 : dp[j][k - 1];
      dp[j][k - 1] = (1ll * dp[j][k] * j * k + dp[j][k - 1]) % P;
    }
    if (j > 1) {
      if (dp[j - 2][k] == -1) Q[++r] = {j - 2, k};
      dp[j - 2][k] = dp[j - 2][k] < 0 ? 0 : dp[j - 2][k];
      dp[j - 2][k] = (1ll * dp[j][k] * j * (j - 1) / 2 + dp[j - 2][k]) % P;
    }
    if (k > 1) {
      if (dp[j + 2][k - 2] == -1) Q[++r] = {j + 2, k - 2};
      dp[j + 2][k - 2] = dp[j + 2][k - 2] < 0 ? 0 : dp[j + 2][k - 2];
      dp[j + 2][k - 2] =
          (1ll * k * (k - 1) / 2 * dp[j][k] + dp[j + 2][k - 2]) % P;
    }
  }
  printf("%d\n", dp[0][0]);
  return 0;
}
