#include <bits/stdc++.h>
using namespace std;
const int M = 505;
int n, m, mod, a, b, cnt[M];
long long dp[2][M][M];
void Add(long long &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int main() {
  scanf("%d%d%d", &n, &m, &mod);
  for (int i = 1; i <= m; ++i)
    for (int j = 1, x; j <= n; ++j) scanf("%1d", &x), cnt[j] += x;
  for (int i = 1; i <= n; ++i) a += cnt[i] == 1, b += cnt[i] == 0;
  int cur = 0;
  dp[cur][a][b] = 1;
  for (int i = m + 1; i <= n; ++i) {
    memset(dp[cur ^ 1], 0, sizeof dp[cur ^ 1]);
    for (int j = 0; j <= n; ++j)
      for (int k = 0; j + k <= n; ++k)
        if (dp[cur][j][k]) {
          if (k && j) Add(dp[cur ^ 1][j][k - 1], dp[cur][j][k] * j * k % mod);
          if (k > 1)
            Add(dp[cur ^ 1][j + 2][k - 2],
                dp[cur][j][k] * k * (k - 1) / 2 % mod);
          if (j > 1)
            Add(dp[cur ^ 1][j - 2][k], dp[cur][j][k] * j * (j - 1) / 2 % mod);
        }
    cur ^= 1;
  }
  printf("%lld\n", dp[cur][0][0]);
  return 0;
}
