#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int n, m, mod;
inline void add_(int& to, int val) {
  to += val;
  if (to >= mod) to -= mod;
}
int dp[2][501][501];
int main() {
  cin >> n >> m >> mod;
  vector<string> vs(m);
  for (int i = 0; i < (m); i++) cin >> vs[i];
  int X[500] = {};
  for (int i = 0; i < (m); i++)
    for (int j = 0; j < (n); j++) {
      if (vs[i][j] == '1') X[j]++;
    }
  int r = 0, p = 0;
  for (int i = 0; i < (n); i++)
    if (X[i] == 0)
      r++;
    else if (X[i] == 1)
      p++;
  dp[0][r][p] = 1;
  auto cur = dp[0];
  auto nxt = dp[1];
  const int rem = n - m;
  for (int i = 0; i < (rem); i++) {
    memset(nxt, 0, sizeof(dp[0]));
    for (int two_rem = 0; two_rem < (501); two_rem++)
      for (int one_rem = 0; one_rem < (501); one_rem++) {
        if (cur[two_rem][one_rem]) {
          long long v = cur[two_rem][one_rem];
          if (two_rem >= 2) {
            add_(nxt[two_rem - 2][one_rem + 2],
                 v * two_rem * (two_rem - 1) / 2 % mod);
          }
          if (two_rem >= 1 && one_rem >= 1) {
            add_(nxt[two_rem - 1][one_rem], v * two_rem * one_rem % mod);
          }
          if (one_rem >= 2) {
            add_(nxt[two_rem][one_rem - 2],
                 v * one_rem * (one_rem - 1) / 2 % mod);
          }
        }
      }
    swap(cur, nxt);
  }
  long long ans = cur[0][0];
  cout << ans << endl;
}
