#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:666000000")
using namespace std;
const int INF = (1 << 30) - 1;
const long double EPS = 1e-9;
void ML(const bool v) {
  if (v) return;
  int *ass;
  for (;;) {
    ass = new int[2500000];
    for (int i = 0; i < 2500000; i++) ass[i] = rand();
  }
}
void TL(const bool v) {
  if (v) return;
  for (;;) cout << rand() % (rand() % 1000 + 1) << endl;
}
void PE(const bool v) {
  if (v) return;
  for (int i = 0; i < 10000; i++) printf("%c", rand() % 256);
  exit(0);
}
char _tmp[100500];
int n, m, MOD;
vector<string> s;
bool LoAd() {
  if (!(3 == scanf("%d%d%d", &n, &m, &MOD))) return false;
  s.resize(m);
  for (int i = 0; i < m; i++) {
    scanf("%s", _tmp);
    s[i] = _tmp;
  };
  return true;
}
vector<int> cnt;
int sv[505][505];
int add(int a, int b) { return (a + b) % MOD; }
int mul(int a, int b) { return (a * 1ll * b) % MOD; }
int go(const int c0, const int c1) {
  if (c0 < 0 || c1 < 0) return 0;
  int &res = sv[c0][c1];
  if (-1 != res) return res;
  if (0 == c0 && 0 == c1) return res = 1;
  res = 0;
  res = add(res, mul(c0 * (c0 - 1) / 2, go(c0 - 2, c1 + 2)));
  res = add(res, mul(c1 * (c1 - 1) / 2, go(c0, c1 - 2)));
  res = add(res, mul(c0 * c1, go(c0 - 1, c1)));
  return res;
}
void SoLvE() {
  cnt.assign(n, 0);
  bool ok = true;
  for (int i = 0; i < m; i++) {
    int cr = 0;
    for (int j = 0; j < (int)(n); j++)
      if ('1' == s[i][j]) {
        cnt[j]++;
        cr++;
      }
    ok &= (cr == 2);
  }
  if (!ok) {
    puts("0");
    return;
  }
  int c0 = 0, c1 = 0, c2 = 0;
  for (int i = 0; i < (int)(n); i++) {
    switch (cnt[i]) {
      case 0:
        c0++;
        break;
      case 1:
        c1++;
        break;
      case 2:
        c2++;
        break;
      default:
        puts("0");
        return;
        break;
    }
  }
  memset(sv, -1, sizeof(sv));
  cout << go(c0, c1) << endl;
}
int main() {
  srand((int)time(NULL));
  LoAd();
  SoLvE();
  return 0;
}
