#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 1;
int dyn[maxn][maxn];
int n;
int ans(int m, int k, long long mod) {
  if (m == 0 && k == 0) return 1;
  if (m < 0 || k < 0) return 0;
  if (dyn[m][k] != -1) return dyn[m][k];
  long long a = 0;
  if (m > 1) a += (((m * (m - 1)) / 2) % mod) * (ans(m - 2, k, mod) % mod);
  a %= mod;
  if (m > 0 && k > 0) a += ((m * k) % mod) * (ans(m, k - 1, mod) % mod);
  a %= mod;
  if (k > 1) a += (((k * (k - 1)) / 2) % mod) * (ans(m + 2, k - 2, mod) % mod);
  a %= mod;
  return dyn[m][k] = a;
}
int main() {
  memset(dyn, -1, sizeof(dyn));
  long long m, mod;
  cin >> n >> m >> mod;
  int arr[n][n];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) {
      char c;
      cin >> c;
      arr[i][j] = (c - '0');
    }
  vector<int> mark;
  for (int i = 0; i < n; i++) {
    int x = 0;
    for (int j = 0; j < m; j++) x += arr[j][i];
    mark.push_back(x);
  }
  int x = 0, y = 0;
  for (int i = 0; i < n; i++) {
    if (mark[i] == 0) x++;
    if (mark[i] == 1) y++;
  }
  cout << ans(y, x, mod) << endl;
  return 0;
}
