#include <bits/stdc++.h>
using namespace std;
char str[510];
int num[510];
long long dp[2][510][510];
int mod;
long long add(long long x, long long y) { return (x + y) % mod; }
int main() {
  int n, m;
  int num0, num1;
  int cur, pre;
  scanf("%d%d%d", &n, &m, &mod);
  memset(num, 0, sizeof(num));
  for (int i = 0; i < m; i++) {
    scanf("%s", str);
    for (int j = 0; j < n; j++) num[j] += (str[j] - '0');
  }
  num0 = num1 = 0;
  for (int i = 0; i < n; i++) {
    if (num[i] == 0)
      num0++;
    else if (num[i] == 1)
      num1++;
  }
  memset(dp, 0, sizeof(dp));
  dp[0][num0][num1] = 1;
  cur = 0;
  for (int i = m + 1; i <= n; i++) {
    cur = (i - m) & 1;
    pre = !cur;
    memset(dp[cur], 0, sizeof(dp[cur]));
    for (int zero = 0; zero <= n; zero++) {
      for (int one = 0; one <= n; one++) {
        if (dp[pre][zero][one] == 0) continue;
        if (zero >= 2)
          dp[cur][zero - 2][one + 2] =
              add(dp[cur][zero - 2][one + 2],
                  zero * (zero - 1) * dp[pre][zero][one] / 2);
        if (zero >= 1 && one >= 1)
          dp[cur][zero - 1][one] =
              add(dp[cur][zero - 1][one], zero * one * dp[pre][zero][one]);
        if (one >= 2)
          dp[cur][zero][one - 2] = add(
              dp[cur][zero][one - 2], one * (one - 1) * dp[pre][zero][one] / 2);
      }
    }
  }
  cout << dp[cur][0][0] << endl;
}
