#include <bits/stdc++.h>
using namespace std;
int dp[510][510];
long long MOD;
vector<string> v;
long long nc2(long long num) { return (num * (num - 1)) / 2; }
int recur(int ones, int zeros) {
  if (ones == 0 and zeros == 0) return 1;
  if (dp[ones][zeros] != -1) {
    return dp[ones][zeros] % MOD;
  }
  long long ret = 0;
  if (ones > 1) {
    ret = (ret + ((recur(ones - 2, zeros) * nc2(ones)) % MOD)) % MOD;
  }
  if (zeros > 1) {
    ret = (ret + ((recur(ones + 2, zeros - 2) * nc2(zeros)) % MOD)) % MOD;
  }
  if (ones >= 1 && zeros >= 1) {
    ret =
        (ret + ((recur(ones, zeros - 1) * ((ones * zeros) % MOD)) % MOD)) % MOD;
  }
  dp[ones][zeros] = ret % MOD;
  return dp[ones][zeros];
}
int solve(int n, int m) {
  int ones = 0;
  int zeros = 0;
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    for (int j = 0; j < m; j++) {
      if (v[j][i] == '1') cnt++;
    }
    if (cnt == 1) ones++;
    if (cnt == 0) zeros++;
  }
  memset(dp, -1, sizeof(dp));
  int res = recur(ones, zeros);
  return res;
}
int main() {
  int n, m;
  cin >> n >> m >> MOD;
  string line = "";
  for (int i = 0; i < m; i++) {
    cin >> line;
    v.push_back(line);
  }
  int res = solve(n, m);
  cout << res << endl;
  return 0;
}
