#include <bits/stdc++.h>
using namespace std;
unsigned long long dp[2][501][501];
vector<string> input;
int main() {
  std::ios::sync_with_stdio(false);
  int n, m;
  unsigned long long mod;
  cin >> n >> m >> mod;
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    input.push_back(s);
  }
  int a = 0, b = 0;
  int pdp = 0;
  for (int i = 0; i < n; i++) {
    int onec = 0;
    for (int j = 0; j < m; j++) {
      onec += input[j][i] == '0' ? 0 : 1;
    }
    if (onec == 1)
      a += 1;
    else if (onec == 0)
      b += 1;
  }
  if (a > 0 && b > 0) dp[pdp][a][b - 1] += a * b;
  if (a >= 2) dp[pdp][a - 2][b] += a * (a - 1) / 2;
  if (b >= 2) dp[pdp][a + 2][b - 2] += b * (b - 1) / 2;
  if (n == m) {
    if (a == 0 && b == 0) {
      cout << 1 << endl;
      return 0;
    } else {
      cout << 0 << endl;
      return 0;
    }
  }
  int rem = n - m;
  pdp = 0;
  for (int i = 0; i < rem; i++) {
    for (a = 0; a <= n; a++) {
      for (b = 0; a + b <= n; b++) {
        if (dp[pdp][a][b] == 0) continue;
        if (b > 1)
          dp[pdp ^ 1][a + 2][b - 2] += dp[pdp][a][b] * b * (b - 1) / 2 % mod;
        if (a > 1)
          dp[pdp ^ 1][a - 2][b] += dp[pdp][a][b] * a * (a - 1) / 2 % mod;
        if (a > 0 && b > 0)
          dp[pdp ^ 1][a][b - 1] += dp[pdp][a][b] * a * b % mod;
      }
    }
    pdp ^= 1;
  }
  unsigned long long res = 0;
  cout << dp[pdp ^ 1][0][0] << endl;
  return 0;
}
