#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-9;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int n, m;
long long mod;
string board[550];
long long dp[1201][1201];
int num[550];
long long memo(long long n2, long long n1) {
  if (n2 + n1 == 1) {
    return 0;
  }
  if (n2 + n1 == 0) {
    return 1;
  }
  if (dp[n2][n1] >= 0) {
    return dp[n2][n1];
  }
  long long res = 0;
  if (n2 >= 2) {
    res += n2 * (n2 - 1) / 2 * memo(n2 - 2, n1 + 2) % mod;
  }
  if (n1 >= 2) {
    res += n1 * (n1 - 1) / 2 * memo(n2, n1 - 2) % mod;
  }
  if (n1 >= 1 and n2 >= 1) {
    res += n1 * n2 * memo(n2 - 1, n1) % mod;
  }
  return dp[n2][n1] = res;
}
int main() {
  cin >> n >> m >> mod;
  for (int i = 0; i < m; i++) {
    cin >> board[i];
    for (int j = 0; j < n; j++) {
      num[j] += board[i][j] == '1';
    }
  }
  int n2, n1;
  n2 = n1 = 0;
  for (int j = 0; j < n; j++) {
    n1 += num[j] == 1;
    n2 += num[j] == 0;
  }
  memset(dp, -1, sizeof(dp));
  cout << memo(n2, n1) % mod << endl;
  return 0;
}
