#include <bits/stdc++.h>
using namespace std;
const long long M = 1e6 + 5;
const long long inf = 2e9 + 5;
const long long MOD = 1e9 + 7;
const double PI = 3.14159265358979323846;
long long n, m, mod, ones, zero;
string s[505];
long long cnt[500], dp[505][505];
long long rec(long long i, long long j) {
  if (i == 0 && j == 0) return 1;
  if (dp[i][j] + 1) return dp[i][j];
  dp[i][j] = 0;
  if (i > 1) dp[i][j] = (dp[i][j] + (i) * (i - 1) / 2 * rec(i - 2, j)) % mod;
  if (j > 1)
    dp[i][j] = (dp[i][j] + (j) * (j - 1) / 2 * rec(i + 2, j - 2)) % mod;
  if (i > 0 && j > 0) dp[i][j] = (dp[i][j] + (i) * (j)*rec(i, j - 1)) % mod;
  return dp[i][j];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> mod;
  for (long long i = 1; i <= m; i++) cin >> s[i];
  for (long long i = 1; i <= m; i++) {
    for (long long j = 0; j < n; j++)
      if (s[i][j] == '1') cnt[j]++;
  }
  for (long long i = 1; i <= n; i++) {
    if (cnt[i - 1] == 1)
      ones++;
    else if (cnt[i - 1] == 0)
      zero++;
  }
  memset(dp, -1, sizeof dp);
  long long y = rec(ones, zero);
  cout << y << "\n";
}
