#include <bits/stdc++.h>
using namespace std;
const int N = 555;
long long f[2][N][N];
int n, m, x, y, p, mod, a[N];
int main() {
  cin >> n >> m >> mod;
  for (int i = (1); i <= (n); i++) a[i] = 2;
  for (int i = (1); i <= (m); i++) {
    char s[N];
    scanf("%s", s + 1);
    for (int j = (1); j <= (n); j++)
      if (s[j] == '1') a[j]--;
  }
  for (int i = (1); i <= (n); i++)
    if (a[i] == 2)
      x++;
    else if (a[i] == 1)
      y++;
  f[p][x][y] = 1;
  for (int i = (m + 1); i <= (n); i++) {
    p ^= 1;
    memset(f[p], 0, sizeof(f[p]));
    for (int j = (0); j <= (n); j++)
      for (int k = (0); k <= (n); k++) {
        if (!f[p ^ 1][j][k]) continue;
        if (j > 1)
          f[p][j - 2][k + 2] =
              (f[p][j - 2][k + 2] + f[p ^ 1][j][k] * (j - 1) * j / 2) % mod;
        if (k > 1)
          f[p][j][k - 2] =
              (f[p][j][k - 2] + f[p ^ 1][j][k] * (k - 1) * k / 2) % mod;
        if (j > 0 && k > 0)
          f[p][j - 1][k] = (f[p][j - 1][k] + f[p ^ 1][j][k] * j * k) % mod;
      }
  }
  cout << f[p][0][0] << endl;
  return 0;
}
