#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, mod;
  cin >> n >> m >> mod;
  long long pd[n][n], cont[n], zero = n, one = 0;
  bool visited[n][n];
  string line;
  memset(cont, 0, sizeof(cont));
  for (int i = 0; i < m; i++) {
    cin >> line;
    for (int j = 0; j < n; j++) {
      if (line[j] == '1') {
        cont[j]++;
        if (cont[j] == 1)
          one++, zero--;
        else if (cont[j] == 2)
          one--;
      }
    }
  }
  memset(pd, 0, sizeof(pd));
  memset(visited, false, sizeof(visited));
  pd[zero][one] = 1;
  visited[zero][one] = true;
  queue<pair<long long, long long> > fila;
  fila.push(make_pair(zero, one));
  while (!fila.empty()) {
    zero = fila.front().first;
    one = fila.front().second;
    fila.pop();
    if (zero == 0 && one == 0) continue;
    long long m = pd[zero][one] % mod;
    if (zero >= 2) {
      pd[zero - 2][one + 2] += zero * (zero - 1) / 2 * m;
      pd[zero - 2][one + 2] %= mod;
      if (!visited[zero - 2][one + 2]) fila.push(make_pair(zero - 2, one + 2));
      visited[zero - 2][one + 2] = true;
    }
    if (zero >= 1 && one >= 1) {
      pd[zero - 1][one] += m * zero * one;
      pd[zero - 1][one] %= mod;
      if (!visited[zero - 1][one]) fila.push(make_pair(zero - 1, one));
      visited[zero - 1][one] = true;
    }
    if (one >= 2) {
      pd[zero][one - 2] += one * (one - 1) / 2 * m;
      pd[zero][one - 2] %= mod;
      if (!visited[zero][one - 2]) fila.push(make_pair(zero, one - 2));
      visited[zero][one - 2] = true;
    }
    visited[zero][one] = false;
  }
  cout << pd[0][0] << endl;
  return 0;
}
