#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
const int maxn = 551;
int n, m;
ll mod;
void add(ll& x, ll y) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  x += y;
  if (x >= mod) x %= mod;
}
void mul(ll& x, ll y) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  x *= y;
  if (x >= mod) x %= mod;
}
ll dp[maxn][maxn];
ll nc2(ll x) { return x * (x - 1) / 2; }
ll solve(ll zero, ll one) {
  if (zero == 0 && one == 0) return 1;
  ll& res = dp[zero][one];
  if (~res) return res;
  res = 0;
  if (zero >= 2) {
    add(res, nc2(zero) * solve(zero - 2, one + 2) % mod);
  }
  if (one >= 2) {
    add(res, nc2(one) * solve(zero, one - 2) % mod);
  }
  if (zero >= 1 && one >= 1) {
    add(res, zero * one % mod * solve(zero - 1, one - 1 + 1) % mod);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> mod;
  vector<int> cols(n);
  for (int r = 0; r < m; r++) {
    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
      cols[i] += int(s[i] - '0');
    }
  }
  vector<int> f(3);
  for (int i = 0; i < n; i++) {
    f[cols[i]]++;
  }
  cout << solve(f[0], f[1]) << endl;
  return 0;
}
