#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chkmin(T &a, T const &b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool chkmax(T &a, T const &b) {
  return a < b ? a = b, true : false;
}
const int M = 505;
int A[M], dp[2][M][M];
char S[M];
int n, m, Mod;
long long F(int x) { return x * (x - 1) >> 1; }
void add(int &x, long long y) { x = (x + y) % Mod; }
int main() {
  scanf("%d%d%d", &n, &m, &Mod);
  for (int i = (0), i_end__ = (m); i < i_end__; ++i) {
    scanf("%s", S);
    int cnt = 0;
    for (int i = (0), i_end__ = (n); i < i_end__; ++i)
      if (S[i] == '1') {
        ++cnt, ++A[i];
        if (A[i] > 2) return puts("0"), 0;
      }
    if (cnt != 2) return puts("0"), 0;
  }
  int cnt[3] = {};
  for (int i = (0), i_end__ = (n); i < i_end__; ++i) ++cnt[A[i]];
  dp[(m - 1) & 1][cnt[1]][cnt[2]] = 1;
  for (int i = (m), i_end__ = (n); i < i_end__; ++i) {
    memset(dp[i & 1], 0, sizeof(dp[i & 1]));
    for (int j = (0), j_end__ = (n + 1); j < j_end__; ++j)
      for (int k = (0), k_end__ = (n + 1); k < k_end__; ++k) {
        long long v = dp[~i & 1][j][k];
        if (!v) continue;
        add(dp[i & 1][j + 2][k], v * F(n - k - j));
        add(dp[i & 1][j][k + 1], v * j * (n - j - k));
        if (j > 1) add(dp[i & 1][j - 2][k + 2], v * F(j));
      }
  }
  printf("%d\n", (dp[~n & 1][0][n] + Mod) % Mod);
  return 0;
}
