#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos((long double)-1.0);
const double EPS = 1e-12;
const int MOD = 1e9 + 7;
template <typename T>
void cmin(T &x, T y) {
  if (y < x) x = y;
}
template <typename T>
void cmax(T &x, T y) {
  if (y > x) x = y;
}
long long qpow(long long x, long long n, long long mod = MOD) {
  if (n < 0) return 0;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long sq(long long x) { return x * x; }
double sq(double x) { return x * x; }
namespace Solver {
void InitOnce() { int t; }
int n, m;
int MOD;
char g[505][505];
void Read() {
  int res = scanf("%d%d%d", &n, &m, &MOD);
  if (res == -1) exit(0);
  for (int i = 1; i <= m; ++i) scanf("%s", g[i] + 1);
}
int dp[2][505][505];
int C2(long long n) { return n * (n - 1) / 2; }
void add(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
void Solve() {
  int cnt0 = 0, cnt1 = 0, cnt2 = 0;
  for (int j = 1; j <= n; ++j) {
    int cur = 0;
    for (int i = 1; i <= m; ++i) cur += (g[i][j] - '0');
    if (cur == 0)
      ++cnt0;
    else if (cur == 1)
      ++cnt1;
    else
      ++cnt2;
  }
  if (m == 0) cnt0 = n;
  memset(dp, 0, sizeof(dp));
  dp[m & 1][cnt0][cnt1] = 1;
  for (int i = m + 1; i <= n; ++i) {
    int t = (i & 1), pt = ((i - 1) & 1);
    int lim = min(n, (n - i + 1) * 2);
    for (int j = 0; j <= lim; ++j) {
      for (int k = 0; k <= lim; ++k) {
        if (j + k > lim) break;
        dp[t][j][k] = 0;
      }
    }
    for (int j = 2; j <= lim; ++j) {
      for (int k = 0; k + 2 <= lim; ++k) {
        if (j + k > lim) break;
        dp[t][j - 2][k + 2] += 1LL * dp[pt][j][k] * (j * (j - 1) / 2) % MOD;
        if (dp[t][j - 2][k + 2] >= MOD) dp[t][j - 2][k + 2] -= MOD;
      }
    }
    for (int j = 1; j <= lim; ++j) {
      for (int k = 0; k <= lim; ++k) {
        if (j + k > lim) break;
        dp[t][j - 1][k] += 1LL * dp[pt][j][k] * (j * k) % MOD;
        if (dp[t][j - 1][k] >= MOD) dp[t][j - 1][k] -= MOD;
      }
    }
    for (int j = 0; j <= lim; ++j) {
      for (int k = 2; k <= lim; ++k) {
        if (j + k > lim) break;
        dp[t][j][k - 2] += 1LL * dp[pt][j][k] * (k * (k - 1) / 2) % MOD;
        if (dp[t][j][k - 2] >= MOD) dp[t][j][k - 2] -= MOD;
      }
    }
  }
  printf("%d\n", dp[n & 1][0][0]);
}
}  // namespace Solver
int main() {
  Solver::InitOnce();
  while (true) {
    Solver::Read();
    Solver::Solve();
  }
  return 0;
}
