#include <bits/stdc++.h>
using namespace std;
const long long N = 5e2 + 7;
long long dp[N][N], sum[N];
int32_t main() {
  long long n, m, MOD;
  cin >> n >> m >> MOD;
  for (long long i = 1; i <= m; i++)
    for (long long j = 1; j <= n; j++) {
      char c;
      cin >> c;
      sum[j] += c - '0';
    }
  long long t0 = 0, t1 = 0;
  for (long long i = 1; i <= n; i++) {
    t0 += (sum[i] == 0 ? 1 : 0);
    t1 += (sum[i] == 1 ? 1 : 0);
  }
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++)
    for (long long j = 0; j <= i; j++) {
      if (j >= 2)
        dp[i - j][j] +=
            (((j * (j - 1) / 2) % MOD) * dp[i - j + 2][j - 2]) % MOD;
      if (i - j >= 2)
        dp[i - j][j] +=
            ((((i - j) * (i - j - 1) / 2) % MOD) * dp[i - j - 2][j]) % MOD;
      dp[i - j][j] += ((i - j) * j * dp[i - j][j - 1]) % MOD;
      dp[i - j][j] %= MOD;
    }
  cout << dp[t1][t0] % MOD << "\n";
}
