#include <bits/stdc++.h>
using namespace std;
long long int mod;
map<pair<long long int, long long int>, long long int> graph[501];
long long int rec(long long int a, long long int b, long long int c) {
  if (a < 0 || b < 0) return 0;
  if (c == 0) return (long long int)1;
  if (graph[c].count(make_pair(a, b)) == 1) {
    return graph[c][make_pair(a, b)];
  }
  long long int res;
  long long int W1, W2, W3;
  W1 = (a * (a - 1)) / (long long int)2;
  W2 = (b * (b - 1)) / (long long int)2;
  W3 = (a * b) % mod;
  res = ((W1 * rec(a - 2, b, c - 1) + W2 * rec(a + 2, b - 2, c - 1))) % mod;
  if (a) {
    res = (res + W3 * rec(a, b - 1, c - 1)) % mod;
  }
  graph[c][make_pair(a, b)] = res;
  return res;
}
int col[501];
void solve() {
  int n, m;
  cin >> n >> m >> mod;
  string s;
  int r = n - m;
  for (int i = 0; i < n; i++) col[i] = 2;
  for (int i = 0; i < m; i++) {
    cin >> s;
    for (int j = 0; j < (s.size()); j++) {
      if (s[j] == '1') col[j]--;
    }
  }
  sort(col, col + n);
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (col[i] < 0) {
      cout << "0" << endl;
      return;
    }
    if (col[i] == 1) a++;
    if (col[i] == 2) b++;
  }
  printf("%lld\n", rec(a, b, r));
}
int main() {
  int T = 1;
  for (int i = 1; i <= T; i++) {
    solve();
  }
  return 0;
}
