#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int powmod(int a, int b) {
  int tmp = 1;
  a %= (10007);
  for (; b; b >>= 1) {
    if (b & 1) tmp = (long long)tmp * a % (10007);
    a = (long long)a * a % (10007);
  }
  return tmp;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <class T>
inline void R(T &xx) {
  xx = 0;
  char ch = getchar();
  bool F = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') F = 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    xx = xx + xx + (xx << 3) + ch - 48, ch = getchar();
  if (F) xx = -xx;
}
template <class T>
inline void add(T &x, T y) {
  for (x += y; x >= (10007); x -= (10007))
    ;
}
int n, m, a[555];
long long P, dp[555][555];
char s[555];
int main() {
  R(n);
  R(m);
  R(P);
  for (int i = 0; i < (int)m; i++) {
    scanf("%s", s);
    for (int j = 0; j < (int)n; j++)
      if (s[j] == '1') a[j]++;
  }
  int t0 = 0, t1 = 0;
  for (int i = 0; i < (int)n; i++) {
    if (a[i] == 0) t0++;
    if (a[i] == 1) t1++;
  }
  dp[t0][t1] = 1;
  for (int i = t0; i >= 0; i--)
    for (int j = n; j >= 0; j--)
      if (dp[i][j] != 0) {
        long long d = dp[i][j];
        if (i >= 2)
          dp[i - 2][j + 2] =
              (dp[i - 2][j + 2] + (d * i * (i - 1) / 2LL) % P) % P;
        if (i && j)
          dp[i - 1][j] =
              (dp[i - 1][j] + ((d * (long long)i) % P * (long long)j) % P) % P;
        if (j >= 2)
          dp[i][j - 2] = (dp[i][j - 2] + (d * j * (j - 1) / 2LL) % P) % P;
      }
  printf("%I64d\n", dp[0][0]);
  return 0;
}
