#include <bits/stdc++.h>
using namespace std;
char a[505][505];
int dp[2][505][505], n, m, MOD, Comb[505];
inline void Prec() {
  int i;
  for (i = 1; i <= 500; ++i) Comb[i] = (i * (i - 1)) / 2;
}
int main() {
  int i, j, k, nr1 = 0, nr2 = 0, cnt, l1, l2;
  scanf("%d%d%d", &n, &m, &MOD);
  Prec();
  for (i = 1; i <= m; ++i) scanf("%s", (a[i] + 1));
  for (i = 1; i <= n; ++i) {
    for (cnt = 0, j = 1; j <= m; ++j) cnt += (a[j][i] == '1');
    if (cnt == 1) ++nr1;
    if (cnt == 2) ++nr2;
  }
  dp[(m & 1)][nr2][nr1] = 1;
  for (i = m; i < n; ++i) {
    l1 = (i & 1);
    l2 = ((i + 1) & 1);
    for (j = 0; j <= n; ++j)
      for (k = 0; k <= n; ++k) dp[l2][j][k] = 0;
    for (j = 0; j <= n; ++j)
      for (k = 0; k <= n; ++k)
        if (dp[l1][j][k]) {
          if (n - j - k >= 2)
            dp[l2][j][k + 2] =
                (dp[l2][j][k + 2] + 1LL * dp[l1][j][k] * Comb[n - j - k]) % MOD;
          if (k >= 1 && n - j - k >= 1)
            dp[l2][j + 1][k] =
                (dp[l2][j + 1][k] + 1LL * dp[l1][j][k] * (n - j - k) * k) % MOD;
          if (k >= 2)
            dp[l2][j + 2][k - 2] =
                (dp[l2][j + 2][k - 2] + 1LL * dp[l1][j][k] * Comb[k]) % MOD;
        }
  }
  printf("%d\n", dp[(n & 1)][n][0]);
  return 0;
}
