#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const double pi = (double)acos(-1.0);
const double eps = (double)1e-8;
const int INF = (int)0x3f3f3f3f;
const long long LNF = (unsigned long long)(-1) >> 2;
const int SINF = (unsigned)~0U >> 1;
const double DINF = (double)1e50;
const int MOD = (int)1e9 + 7;
const int maxm = (int)1e5 + 20;
const int maxn = (int)5e2 + 20;
int n, m, mod;
long long dp[2][maxn][maxn];
int pre[maxn];
char s[maxn];
inline void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline void init() {
  memset(pre, 0, sizeof(pre));
  memset(dp, 0, sizeof(dp));
}
int main() {
  while (~scanf("%d%d%d", &n, &m, &mod)) {
    init();
    for (int i = 0; i < m; i++) {
      scanf("%s", s + 1);
      for (int j = 1; j <= n; j++)
        if (s[j] == '1') pre[j]++;
    }
    if (m == n || m == n - 1) {
      puts("1");
      continue;
    }
    int a = 0, b = 0;
    for (int i = 1; i <= n; i++)
      if (pre[i] == 0)
        a++;
      else if (pre[i] == 1)
        b++;
    dp[0][a][b] = 1;
    int f = 0;
    for (int T = m + 1; T <= n; T++) {
      f ^= 1;
      memset(dp[f], 0, sizeof(int) * (n + 1));
      for (int two = n; two >= 0; two--) {
        for (int one = n - two; one >= 0; one--) {
          if (!dp[f ^ 1][two][one]) continue;
          if (two >= 2) {
            dp[f][two - 2][one + 2] +=
                dp[f ^ 1][two][one] * two * (two - 1) / 2;
            dp[f][two - 2][one + 2] %= mod;
          }
          if (two >= 1 && one >= 1) {
            dp[f][two - 1][one] += dp[f ^ 1][two][one] * two * one;
            dp[f][two - 1][one] %= mod;
          }
          if (one >= 2) {
            dp[f][two][one - 2] += dp[f ^ 1][two][one] * one * (one - 1) / 2;
            dp[f][two][one - 2] %= mod;
          }
        }
      }
    }
    printf("%lld\n", dp[f][0][0]);
  }
  return 0;
}
