#include <bits/stdc++.h>
using namespace std;
const bool db = false;
int n, m, mod;
int g[555], ones, twos;
int dp[555][555];
int calc(int o, int t) {
  if (dp[o][t] != -1) return dp[o][t];
  if (o == 0 && t == 1) return 0;
  if (o == 0 && t == 0) return 1;
  int &res = dp[o][t];
  res = 0;
  if (o >= 2) {
    res += o * 1LL * (o - 1) / 2 % mod * calc(o - 2, t) % mod;
    res %= mod;
  }
  if (o >= 1 && t >= 1) {
    res += o * 1LL * t % mod * calc(o, t - 1) % mod;
    res %= mod;
  }
  if (t >= 2) {
    res += t * 1LL * (t - 1) / 2 % mod * calc(o + 2, t - 2) % mod;
    res %= mod;
  }
  return res;
}
int main() {
  scanf("%d%d%d", &n, &m, &mod);
  for (int i = 1; i <= n; ++i) g[i] = 2;
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= n; ++j) {
      char c;
      cin >> c;
      if (c == '1') --g[j];
    }
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; ++i)
    if (g[i] == 1)
      ++ones;
    else if (g[i] == 2)
      ++twos;
  cout << calc(ones, twos) << endl;
  getchar();
  getchar();
  return 0;
}
