#include <bits/stdc++.h>
const int md = 1e9 + 7;
const long long hs = 199;
using namespace std;
int n, m, mod, dp[501][501], c[500] = {}, v[2] = {};
char b;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> mod;
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) {
      cin >> b;
      if (b == '1') c[j]++;
    }
  for (int i = 0; i < n; i++)
    if (c[i] != 2) v[c[i] ^ 1]++;
  for (int i = 0; i <= 500; i++)
    for (int j = 0; i + j <= 500; j++) {
      if ((i + j) < 2)
        dp[i][j] = 1 - i - j;
      else {
        dp[i][j] = 0;
        if (i > 1)
          dp[i][j] =
              (dp[i][j] + (long long)i * (i - 1) / 2 * dp[i - 2][j + 2]) % mod;
        if (j > 1)
          dp[i][j] =
              (dp[i][j] + (long long)j * (j - 1) / 2 * dp[i][j - 2]) % mod;
        if (i > 0 && j > 0)
          dp[i][j] = (dp[i][j] + (long long)i * j * dp[i - 1][j]) % mod;
      }
    }
  cout << dp[v[1]][v[0]] << '\n';
}
