#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
} dl[600000];
int l, r, a[510], c[510][510], q[510][510];
long long mod, f[510][510];
void ditui(int k) {
  q[dl[k].x][dl[k].y] = 0;
  if (dl[k].x > 0 && dl[k].y > 0) {
    if (!q[dl[k].x][dl[k].y - 1]) {
      r++;
      dl[r].x = dl[k].x;
      dl[r].y = dl[k].y - 1;
      f[dl[k].x][dl[k].y - 1] = (f[dl[k].x][dl[k].y] * dl[k].x * dl[k].y) % mod;
      q[dl[k].x][dl[k].y - 1] = 1;
    } else {
      f[dl[k].x][dl[k].y - 1] =
          (f[dl[k].x][dl[k].y - 1] + f[dl[k].x][dl[k].y] * dl[k].x * dl[k].y) %
          mod;
    }
  }
  if (dl[k].x > 1) {
    if (!q[dl[k].x - 2][dl[k].y]) {
      r++;
      dl[r].x = dl[k].x - 2;
      dl[r].y = dl[k].y;
      f[dl[k].x - 2][dl[k].y] = (f[dl[k].x][dl[k].y] * c[dl[k].x][2]) % mod;
      q[dl[k].x - 2][dl[k].y] = 1;
    } else {
      f[dl[k].x - 2][dl[k].y] =
          (f[dl[k].x - 2][dl[k].y] + f[dl[k].x][dl[k].y] * c[dl[k].x][2]) % mod;
    }
  }
  if (dl[k].y > 1) {
    if (!q[dl[k].x + 2][dl[k].y - 2]) {
      r++;
      dl[r].x = dl[k].x + 2;
      dl[r].y = dl[k].y - 2;
      f[dl[k].x + 2][dl[k].y - 2] = (f[dl[k].x][dl[k].y] * c[dl[k].y][2]) % mod;
      q[dl[k].x + 2][dl[k].y - 2] = 1;
    } else {
      f[dl[k].x + 2][dl[k].y - 2] =
          (f[dl[k].x + 2][dl[k].y - 2] + f[dl[k].x][dl[k].y] * c[dl[k].y][2]) %
          mod;
    }
  }
}
int main() {
  int i, j, k, n, m, one, zero;
  char ch;
  scanf("%d%d%I64d", &n, &m, &mod);
  memset(a, 0, sizeof(a));
  memset(q, 0, sizeof(q));
  memset(f, 0, sizeof(f));
  getchar();
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      scanf("%c", &ch);
      if (ch == '1') a[j]++;
    }
    getchar();
  }
  one = 0;
  zero = 0;
  for (i = 1; i <= n; i++)
    if (a[i] == 0)
      zero++;
    else if (a[i] == 1)
      one++;
  for (i = 0; i <= n; i++) {
    c[i][0] = 1;
    c[i][i] = 1;
    for (j = 1; j < i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
  }
  l = 1;
  r = 1;
  f[one][zero] = 1;
  q[one][zero] = 1;
  dl[1].x = one;
  dl[1].y = zero;
  while (l <= r) {
    ditui(l);
    l++;
  }
  printf("%I64d\n", f[0][0]);
  return 0;
}
