#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 505;
long long N, M, MOD;
long long grid[MAXN][MAXN];
long long dp[MAXN][MAXN];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> M >> MOD;
  for (long long i = 0; i < M; i++)
    for (long long j = 0; j < N; j++) {
      char t;
      cin >> t;
      grid[i][j] = (t == '1');
    }
  long long cnt1 = 0, cnt2 = 0;
  for (long long c = 0; c < N; c++) {
    long long t = 0;
    for (long long r = 0; r < M; r++) t += grid[r][c];
    if (t == 1) cnt1++;
    if (t == 0) cnt2++;
  }
  dp[cnt1][cnt2] = 1;
  for (long long j = cnt2; j >= 0; j--) {
    for (long long i = cnt1 + cnt2; i >= 0; i--) {
      dp[i][j] += dp[i][j + 1] * (j + 1) * i;
      dp[i][j] %= MOD;
      if (i >= 2) {
        dp[i][j] += dp[i - 2][j + 2] * (j + 2) * (j + 1) / 2;
        dp[i][j] %= MOD;
      }
      dp[i][j] += dp[i + 2][j] * (i + 2) * (i + 1) / 2;
      dp[i][j] %= MOD;
    }
  }
  cout << dp[0][0] << endl;
}
