#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int dp[2][N][N], MOD, n, m;
int col[N];
vector<string> mp(N);
void add(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
int main() {
  int t, x, y, z, ca = 1;
  cin >> n >> m >> MOD;
  for (int i = 0; i < (int)(m); ++i) cin >> mp[i];
  int bad = 0;
  for (int i = 0; i < (int)(m); ++i) {
    int cnt = 0;
    for (int j = 0; j < (int)(n); ++j)
      if (mp[i][j] == '1') col[j]++, cnt++;
    if (cnt > 2) {
      bad = 1;
    }
    for (int j = 0; j < (int)(n); ++j)
      if (col[j] > 2) {
        bad = 1;
        break;
      }
    if (bad) break;
  }
  if (bad) {
    cout << 0 << endl;
    return 0;
  }
  int cur = 0;
  x = y = 0;
  for (int i = 0; i < (int)(n); ++i)
    if (col[i] == 0)
      x++;
    else if (col[i] == 1)
      y++;
  dp[cur][x][y] = 1;
  for (int row = (int)(m); row <= (int)(n - 1); ++row) {
    for (int cnt0 = (int)(0); cnt0 <= (int)(n); ++cnt0) {
      for (int cnt1 = (int)(0); cnt1 <= (int)(n); ++cnt1)
        if (dp[cur][cnt0][cnt1]) {
          if (cnt0 >= 2) {
            add(dp[cur ^ 1][cnt0 - 2][cnt1 + 2],
                1LL * cnt0 * (cnt0 - 1) / 2 % MOD * dp[cur][cnt0][cnt1] % MOD);
          }
          if (cnt1 >= 2) {
            add(dp[cur ^ 1][cnt0][cnt1 - 2],
                1LL * cnt1 * (cnt1 - 1) / 2 % MOD * dp[cur][cnt0][cnt1] % MOD);
          }
          if (cnt0 >= 1 && cnt1 >= 1) {
            add(dp[cur ^ 1][cnt0 - 1][cnt1],
                1LL * cnt0 * cnt1 % MOD * dp[cur][cnt0][cnt1] % MOD);
          }
        }
    }
    memset(dp[cur], 0, sizeof(dp[cur]));
    cur ^= 1;
  }
  cout << dp[cur][0][0] << endl;
  return 0;
}
