#include <bits/stdc++.h>
int DBG = 0;
using namespace std;
const int MAXN = 505;
int m, n, cnt[MAXN];
long long f[2][MAXN][MAXN], mod;
int main() {
  scanf("%d%d%d\n", &n, &m, &mod);
  for (int i = 1; i <= m; ++i) {
    char buf[MAXN];
    gets(buf + 1);
    for (int j = 1; j <= n; ++j)
      if (buf[j] == '1') cnt[j]++;
  }
  int cnt0 = 0, cnt1 = 0;
  for (int j = 1; j <= n; ++j)
    if (cnt[j] == 0)
      cnt0++;
    else if (cnt[j] == 1)
      cnt1++;
  f[m % 2][cnt0][cnt1] = 1;
  for (int i = m + 1; i <= n; ++i) {
    int cur = i % 2, last = (i - 1) % 2;
    for (int j = 0; j <= n - i; ++j) {
      int k = 2 * (n - i - j);
      f[cur][j][k] = 0;
      if (k >= 2 && j + 2 <= n)
        f[cur][j][k] =
            (f[cur][j][k] + f[last][j + 2][k - 2] * (j + 2) * (j + 1) / 2) %
            mod;
      if (j + k + 2 <= n)
        f[cur][j][k] =
            (f[cur][j][k] + f[last][j][k + 2] * (k + 2) * (k + 1) / 2) % mod;
      if (j + 1 + k <= n)
        f[cur][j][k] = (f[cur][j][k] + f[last][j + 1][k] * (j + 1) * k) % mod;
    }
  }
  printf("%d", f[n % 2][0][0]);
}
