#include <bits/stdc++.h>
using namespace std;
const int MN = 1000;
long long mod, n, m, dp[MN][MN], col[MN], yek, sefr;
bool mark[MN][MN];
long long rec(int x, int y) {
  long long ret = 0;
  if (y == 0 && x == 0) {
    return 1;
  }
  if (y + x == 1) return 0;
  if (mark[x][y]) return dp[x][y];
  mark[x][y] = true;
  long long s = ((long long)x * y) % mod;
  if (x >= 1 && y >= 1) ret += s * rec(x - 1, y);
  s = (((long long)x * (x - 1) / 2)) % mod;
  if (x >= 2) ret += (long long)s * rec(x - 2, y + 2);
  ret %= mod;
  s = (((long long)y * (y - 1)) / 2) % mod;
  if (y >= 2) ret += (long long)s * rec(x, y - 2);
  ret %= mod;
  dp[x][y] = ret;
  return ret;
}
int main() {
  string st;
  cin >> n >> m >> mod;
  for (int i = 0; i < m; i++) {
    cin >> st;
    for (int j = 0; j < n; j++) {
      if (st[j] == '1') {
        col[j]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (col[i] == 0) sefr++;
    if (col[i] == 1) yek++;
  }
  cout << rec(sefr, yek);
  return 0;
}
