#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
bool mat[500][500];
long long n, m, mod;
long long twos, ones;
long long dp[501][501];
long long rec(int i, int remt, int remo) {
  if (i == n - m) return (!remt) && (!remo);
  if (dp[i][remt] != -1) return dp[i][remt];
  long long s1 = 0;
  if (remt >= 2) {
    s1 = rec(i + 1, remt - 2, remo + 2) * (((remt * (remt - 1LL)) / 2LL) % mod);
    s1 %= mod;
  }
  long long s2 = 0;
  if (remo >= 2) {
    s2 = rec(i + 1, remt, remo - 2) * (((remo * (remo - 1LL)) / 2LL) % mod);
    s2 %= mod;
  }
  long long s3 = 0;
  if (remo && remt) {
    s3 = rec(i + 1, remt - 1, remo) * ((remo * remt) % mod);
    s3 %= mod;
  }
  return dp[i][remt] = (s1 + s2 + s3) % mod;
}
int main() {
  cin >> n >> m >> mod;
  for (int i = 0; i < m; i++) {
    char c;
    for (int j = 0; j < n; j++) {
      cin >> c;
      mat[i][j] = (c == '1');
    }
  }
  for (int j = 0; j < n; j++) {
    int c = 0;
    for (int i = 0; i < m; i++) c += mat[i][j];
    twos += (c == 0);
    ones += (c == 1);
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(0, twos, ones) << endl;
}
