#include <bits/stdc++.h>
using namespace std;
const int N = 5e2 + 2;
long long n, m, mod;
long long dp[N][N];
char ar[N][N];
long long solve(int nul, int one) {
  if (nul == 0 && one == 0) return 1;
  if (dp[nul][one] != -1) return dp[nul][one];
  long long ret = solve(nul - 1, one) * nul * one;
  ret %= mod;
  if (nul >= 2) ret += solve(nul - 2, one + 2) * nul * (nul - 1) / 2;
  ret %= mod;
  if (one >= 2) ret += solve(nul, one - 2) * one * (one - 1) / 2;
  ret %= mod;
  return dp[nul][one] = ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> mod;
  bool good = 1;
  for (int i = 1; i <= m; i++) {
    int cnt = 0;
    for (int j = 1; j <= n; j++) {
      cin >> ar[i][j];
      cnt += (ar[i][j] == '1');
    }
    if (cnt != 2) good = 0;
  }
  int nul = 0;
  int one = 0;
  for (int i = 1; i <= n && good; i++) {
    int cnt = 0;
    for (int j = 1; j <= m; j++) {
      cnt += (ar[j][i] == '1');
    }
    nul += (cnt == 0);
    one += (cnt == 1);
    if (cnt > 2) good = 0;
  }
  if (!good) {
    cout << "0\n";
    return 0;
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(nul, one) << '\n';
  return 0;
}
