#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
int n, m;
long long int dp[500 + 7][500 + 7], mod;
char grid[500 + 7][500 + 7];
void reset() { memset((dp), -1, sizeof(dp)); }
long long int cal(long long int x) {
  long long int ret = x * (x - 1);
  ret /= (long long int)2;
  return (ret % mod);
}
long long int rec(long long int r, long long int c) {
  if (r == 0 and c == 0) return 1;
  long long int &ret = dp[r][c];
  if (ret != -1) return ret;
  ret = 0;
  if (r > 1) {
    ret = (ret + (cal(r) * rec(r - 2, c + 2)) % mod) % mod;
  }
  if (r >= 1 and c >= 1) {
    ret = (ret + (r * c * rec(r - 1, c)) % mod) % mod;
  }
  if (c > 1) {
    ret = (ret + (cal(c) * rec(r, c - 2)) % mod) % mod;
  }
  return ret;
}
int main() {
  int x, y, cnt, i, j, k;
  long long int ans;
  while (scanf("%d %d %lld", &n, &m, &mod) == 3) {
    x = y = 0;
    reset();
    for (i = 0; i < m; i++) {
      scanf("%s", grid[i]);
    }
    for (i = 0; i < n; i++) {
      cnt = 0;
      for (j = 0; j < m; j++)
        if (grid[j][i] == '1') cnt++;
      if (cnt == 1)
        y++;
      else if (!cnt)
        x++;
    }
    ans = rec(x, y);
    printf("%lld\n", ans);
  }
  return 0;
}
