#include <bits/stdc++.h>
using namespace std;
const int maxn = 510;
int N, mod;
long long int dp[2 * maxn][2 * maxn];
long long int solve(int ones, int twos) {
  if (ones < 0 || twos < 0 || ones > N || twos > N) return 0;
  if (twos == N) return 1;
  if (dp[ones][twos] != -1) return dp[ones][twos];
  int emp = N - ones - twos;
  long long int v1, v2, v3;
  v1 = ((ones * (ones - 1) / 2) * solve(ones - 2, twos + 2)) % mod;
  v2 = ((emp * (emp - 1) / 2) * solve(ones + 2, twos)) % mod;
  v3 = (ones * emp * solve(ones, twos + 1)) % mod;
  return dp[ones][twos] = ((v1 + v2 + v3) % mod);
}
int num[maxn];
int main() {
  int M;
  cin >> N >> M >> mod;
  memset(num, 0, sizeof num);
  string s;
  for (int i = 0; i < M; i++) {
    cin >> s;
    for (int k = 0; k < N; k++)
      if (s[k] == '1') num[k]++;
  }
  int ones = 0, twos = 0;
  for (int i = 0; i < N; i++)
    if (num[i] == 1)
      ones++;
    else if (num[i] == 2)
      twos++;
  memset(dp, -1, sizeof dp);
  cout << solve(ones, twos) << endl;
  return 0;
}
