#include <bits/stdc++.h>
int N, M, MOD;
int C[555][555];
int Dy[555][555];
char In[555][555];
long long Get(int n, int x, int y, int z) {
  if (Dy[n][y] > 0) return Dy[n][y] - 1;
  if (x < 0 || y < 0 || z < 0) return 0;
  if (n > N) return 1;
  Dy[n][y] = (Get(n + 1, x - 2, y + 2, z) * C[x][2] +
              Get(n + 1, x, y - 2, z + 2) * C[y][2] +
              Get(n + 1, x - 1, y, z + 1) * x * y) %
                 MOD +
             1;
  return Dy[n][y] - 1;
}
void GETC(int n, int k) {
  C[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= k; j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
  }
  return;
}
int main() {
  scanf("%d%d%d", &N, &M, &MOD);
  GETC(500, 500);
  for (int i = 1; i <= M; i++) scanf("%s", In[i] + 1);
  int xx = 0, yy = 0, zz = 0;
  for (int j = 1; j <= N; j++) {
    int score = 0;
    for (int i = 1; i <= M; i++) score += (In[i][j] - '0');
    if (score >= 3) {
      printf("0");
      return 0;
    }
    if (score == 0) xx++;
    if (score == 1) yy++;
    if (score == 2) zz++;
  }
  printf("%I64d", Get(M + 1, xx, yy, zz));
}
