#include <bits/stdc++.h>
using namespace std;
long long dp[2][505][505];
int main() {
  long long n, m, MOD;
  scanf("%I64d %I64d %I64d", &n, &m, &MOD);
  memset(dp, 0, sizeof dp);
  long long a[505];
  for (int i = 1; i <= n; i++) a[i] = 2;
  for (int i = 1; i <= m; i++) {
    char s[505];
    scanf("%s", s);
    for (int j = 0; j < n; j++)
      if (s[j] == '1') a[j + 1]--;
  }
  int x = 0, y = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == 2)
      x++;
    else if (a[i] == 1)
      y++;
  int cur = 0;
  dp[cur][x][y] = 1;
  for (int i = m + 1; i <= n; i++) {
    cur = cur ^ 1;
    memset(dp[cur], 0, sizeof dp[cur]);
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k <= n; k++) {
        if (!dp[cur ^ 1][j][k]) continue;
        if (j >= 2)
          dp[cur][j - 2][k + 2] =
              (dp[cur][j - 2][k + 2] + dp[cur ^ 1][j][k] * (j - 1) * j / 2) %
              MOD;
        if (k >= 2)
          dp[cur][j][k - 2] =
              (dp[cur][j][k - 2] + dp[cur ^ 1][j][k] * (k - 1) * k / 2) % MOD;
        if (j >= 1 && k >= 1)
          dp[cur][j - 1][k] =
              (dp[cur][j - 1][k] + dp[cur ^ 1][j][k] * j * k) % MOD;
      }
    }
  }
  printf("%I64d\n", dp[cur][0][0]);
  return 0;
}
