#include <bits/stdc++.h>
using namespace std;
int n, m;
long long MOD;
long long dp[505][505], num[505];
bool vis[505][505];
char s[505];
long long solve(int s1, int s2) {
  if (vis[s1][s2]) return dp[s1][s2];
  vis[s1][s2] = 1;
  if (s1 == 0 && s2 == 0) return dp[s1][s2] = 1;
  if (s1 >= 2)
    dp[s1][s2] = (dp[s1][s2] + solve(s1 - 2, s2 + 2) * s1 * (s1 - 1) / 2) % MOD;
  if (s1 >= 1) dp[s1][s2] = (dp[s1][s2] + solve(s1 - 1, s2) * s1 * s2) % MOD;
  if (s2 >= 2)
    dp[s1][s2] = (dp[s1][s2] + solve(s1, s2 - 2) * s2 * (s2 - 1) / 2) % MOD;
  return dp[s1][s2];
}
int main() {
  int s1, s2;
  while (scanf("%d%d%I64d", &n, &m, &MOD) != EOF) {
    s1 = 0, s2 = 0;
    memset(vis, 0, sizeof(vis));
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= m; i++) {
      scanf("%s", s + 1);
      for (int j = 1; j <= n; j++)
        if (s[j] == '1') {
          num[j]++;
        }
    }
    for (int i = 1; i <= n; i++) {
      if (num[i] == 0) s1++;
      if (num[i] == 1) s2++;
    }
    printf("%I64d\n", solve(s1, s2));
  }
  return 0;
}
