#include <bits/stdc++.h>
using namespace std;
int n, m;
long long mod;
string s;
int a[509];
long long col1 = 0, col2 = 0;
long long b[509][509];
long long dp(long long x, long long y) {
  if (x == 0 && y == 0) return (long long)(1);
  if (b[x][y] != -1) return b[x][y];
  b[x][y] = 0;
  if (x > 1)
    b[x][y] =
        (b[x][y] + (((x * (x - 1) / 2) % mod) * (dp(x - 2, y + 2)) % mod)) %
        mod;
  if ((x >= 1) && (y >= 1))
    b[x][y] = (b[x][y] + (((x * y) % mod) * (dp(x - 1, y)) % mod)) % mod;
  if (y > 1)
    b[x][y] =
        (b[x][y] + (((y * (y - 1) / 2) % mod) * (dp(x, y - 2)) % mod)) % mod;
  return b[x][y];
}
int main() {
  cin >> n >> m >> mod;
  for (int i = 0; i < m; i++) {
    cin >> s;
    for (int j = 0; j < n; j++) {
      if (s[j] == '1') a[j]++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 0)
      col1++;
    else if (a[i] == 1)
      col2++;
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) b[i][j] = -1;
  cout << dp(col1, col2);
  return 0;
}
