#include <bits/stdc++.h>
using namespace std;
long long dpMem[505][505], mod;
int n, m, nr1[505], z, u;
char ch;
long long mem(int rw, int z, int o) {
  if (rw == n) {
    if (!z && !o) return 1;
    return 0;
  }
  if (dpMem[z][o] != -1) return dpMem[z][o];
  long long act = 0;
  if (z >= 2) {
    act += (z * (z - 1) / 2) * mem(rw + 1, z - 2, o + 2);
  }
  if (o >= 2) {
    act += (o * (o - 1) / 2) * mem(rw + 1, z, o - 2);
  }
  if (z && o) {
    act += (o * z) * mem(rw + 1, z - 1, o);
  }
  act %= mod;
  dpMem[z][o] = act;
  return dpMem[z][o];
}
int main() {
  cin >> n >> m >> mod;
  for (int i = 1; i <= m; ++i)
    for (int i = 1; i <= n; ++i) {
      cin >> ch;
      if (ch == '1') ++nr1[i];
    }
  if (n == m) {
    cout << "1\n";
    return 0;
  }
  for (int i = 1; i <= n; ++i)
    if (nr1[i] == 1)
      ++u;
    else if (nr1[i] == 0)
      ++z;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j) dpMem[i][j] = -1;
  mem(m, z, u);
  cout << dpMem[z][u] << '\n';
  return 0;
}
