#include <bits/stdc++.h>
using namespace std;
const long long N = 510;
long long dp[2][N][N], sum[N];
char a[N][N];
signed main() {
  long long n, m, mod, cnt1 = 0, cnt2 = 0;
  scanf("%lld%lld%lld", &n, &m, &mod);
  for (long long i = 1; i <= m; i++) scanf("%s", a[i] + 1);
  for (long long i = 1; i <= m; i++)
    for (long long j = 1; j <= n; j++) sum[j] += (a[i][j] - '0');
  for (long long i = 1; i <= n; i++) cnt1 += (sum[i] == 1), cnt2 += (!sum[i]);
  dp[0][cnt1][cnt2] = 1;
  bool k = 1;
  for (long long p = m + 1; p <= n; p++, k ^= 1) {
    for (long long i = 0; i <= n; i++)
      for (long long j = 0; j <= n; j++) dp[k][i][j] = 0;
    for (long long i = 0; i <= n; i++) {
      for (long long j = 0; j <= n; j++) {
        if (!dp[k ^ 1][i][j]) continue;
        if (j >= 1 && i >= 1)
          dp[k][i][j - 1] = (dp[k][i][j - 1] + dp[k ^ 1][i][j] * i * j) % mod;
        if (i >= 2)
          dp[k][i - 2][j] =
              (dp[k][i - 2][j] + dp[k ^ 1][i][j] * i * (i - 1) / 2) % mod;
        if (j >= 2)
          dp[k][i + 2][j - 2] =
              (dp[k][i + 2][j - 2] + dp[k ^ 1][i][j] * j * (j - 1) / 2) % mod;
      }
    }
  }
  printf("%lld", dp[k ^ 1][0][0]);
  return 0;
}
