#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const double PI = acos(-1.0);
long long n, m, mod;
char c;
long long f[2][N][N];
int cnt[N];
void solve() {
  cin >> n >> m >> mod;
  for (int i = (1); i <= (n); i++) cnt[i] = 2;
  for (int i = (1); i <= (m); i++)
    for (int j = (1); j <= (n); j++) cin >> c, cnt[j] -= (c - '0');
  long long ans1 = 0, ans2 = 0;
  for (int i = (1); i <= (n); i++) ans1 += (cnt[i] == 1), ans2 += (cnt[i] == 2);
  f[m & 1][ans1][ans2] = 1;
  for (int i = m + 1; i <= n; i++) {
    for (int j = (0); j <= (n); j++)
      for (int k = (0); k <= (n); k++) f[i & 1][j][k] = 0;
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k <= n; k++) {
        if (f[(i - 1) & 1][j][k] == 0) continue;
        if (j >= 2)
          f[i & 1][j - 2][k] +=
              (f[(i - 1) & 1][j][k] * (j * (j - 1) / 2 % mod)) % mod,
              f[i & 1][j - 2][k] %= mod;
        if (j >= 1 && k >= 1)
          f[i & 1][j][k - 1] += f[(i - 1) & 1][j][k] * j % mod * k % mod,
              f[i & 1][j][k - 1] %= mod;
        if (k >= 2)
          f[i & 1][j + 2][k - 2] +=
              (f[(i - 1) & 1][j][k] * (k * (k - 1) / 2 % mod)) % mod,
              f[i & 1][j + 2][k - 2] %= mod;
      }
    }
  }
  cout << f[n & 1][0][0] << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
