#include <bits/stdc++.h>
using namespace std;
int n;
long long M;
long long dp[2][505][505];
int ans;
int c[505];
int rs;
void precompute() {}
void read() {
  scanf("%d", &n);
  scanf("%d", &rs);
  scanf("%lld", &M);
  for (int i = 0; i < rs; ++i) {
    char st[505];
    scanf("%s", st);
    for (int j = 0; j < n; ++j) {
      c[j] += (st[j] == '1');
    }
  }
}
void preprocess() {}
inline void upd(long long &val, long long inc) {
  if (inc >= M) inc %= M;
  val += inc;
  if (val >= M) val -= M;
}
void solve() {
  int c0 = 0, c1 = 0;
  for (int i = 0; i < n; ++i) {
    if (c[i] == 0) c0++;
    if (c[i] == 1) c1++;
  }
  dp[0][c0][c1] = 1;
  for (int i = rs; i < n; ++i) {
    int cur = 0;
    int nxt = 1;
    memset(dp[nxt], 0, sizeof dp[1]);
    for (int ct0 = 0; ct0 <= n; ++ct0) {
      for (int ct1 = 0; ct1 <= n - ct0 and ct1 + ct0 <= (n - i + 1) * 2;
           ++ct1) {
        if (dp[0][ct0][ct1] == 0) continue;
        if (ct1 >= 2) {
          upd(dp[nxt][ct0][ct1 - 2], (ct1 * (ct1 - 1) / 2) * dp[cur][ct0][ct1]);
        }
        if (ct0 >= 1 and ct1 >= 1) {
          upd(dp[nxt][ct0 - 1][ct1], ct0 * ct1 * dp[cur][ct0][ct1]);
        }
        if (ct0 >= 2) {
          upd(dp[nxt][ct0 - 2][ct1 + 2],
              (ct0 * (ct0 - 1) / 2) * dp[cur][ct0][ct1]);
        }
      }
    }
    memcpy(dp[0], dp[1], sizeof dp[1]);
  }
  cout << dp[0][0][0];
}
int main() {
  precompute();
  read();
  preprocess();
  solve();
  return 0;
}
