#include <bits/stdc++.h>
using namespace std;
const int MAXN = 505;
long long int n, m, mod;
long long int columnCount[MAXN];
long long int DP[MAXN][MAXN];
inline long long int nc2(long long int n) { return n * (n - 1) / 2; }
long long int calc(long long int z, long long int o) {
  if (z == 0 and o == 0) return 1;
  if (DP[z][o] == -1) {
    DP[z][o] = 0;
    if (z > 1) DP[z][o] += nc2(z) * calc(z - 2, o + 2) % mod, DP[z][o] %= mod;
    if (z > 0 and o > 0)
      DP[z][o] += z * o * calc(z - 1, o) % mod, DP[z][o] %= mod;
    if (o > 1) DP[z][o] += nc2(o) * calc(z, o - 2) % mod, DP[z][o] %= mod;
  }
  return DP[z][o];
}
int main() {
  memset(DP, -1, MAXN * MAXN * sizeof(long long int));
  cin >> n >> m >> mod;
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      char c;
      cin >> c;
      if (c == '1') ++columnCount[j];
    }
  }
  int zeroes = 0, ones = 0;
  for (int i = 0; i < n; ++i) {
    if (columnCount[i] == 0) ++zeroes;
    if (columnCount[i] == 1) ++ones;
  }
  cout << calc(zeroes, ones) << endl;
}
