#include <bits/stdc++.h>
int n, m, mod, d[505][505];
int no1[505] = {0}, t1 = 0, t2 = 0;
int dp(long long N, long long M) {
  if (N < 0 || M < 0) return 0;
  if (!N && !M) return 1;
  if (d[N][M] != -1) return d[N][M];
  int ret = 0;
  if (N >= 2) ret = (ret + dp(N - 2, M) * N * (N - 1) / 2) % mod;
  if (N >= 1 && M >= 1) ret = (ret + N * M * dp(N, M - 1)) % mod;
  if (M >= 2) ret = (ret + dp(N + 2, M - 2) * M * (M - 1) / 2) % mod;
  return d[N][M] = ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &mod);
  for (int i = 0; i < m; i++) {
    getchar();
    for (int j = 0; j < n; j++) no1[j] += getchar() == '1';
  }
  for (int i = 0; i < n; i++) {
    t1 += no1[i] == 1;
    t2 += no1[i] == 0;
  }
  memset(d, -1, sizeof(d));
  printf("%d\n", dp(t1, t2) % mod);
  return 0;
}
