#include <bits/stdc++.h>
using namespace std;
int n, m, mod;
int a[1000][1000];
long long d[1005][1005];
int main() {
  cin >> n >> m >> mod;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      char x;
      cin >> x;
      a[i][j] = x - '0';
    }
  }
  int cnt1, cnt2;
  cnt1 = 0;
  cnt2 = 0;
  for (int j = 1; j <= n; j++) {
    int cnt = 0;
    for (int i = 1; i <= m; i++) {
      cnt += a[i][j];
    }
    if (cnt == 1) {
      cnt1++;
    }
    if (cnt == 0) {
      cnt2++;
    }
  }
  d[0][0] = 1;
  for (long long j = 0; j <= 1001; j++) {
    for (long long i = 0; i <= 1001; i++) {
      if (i == 0 && j == 0) {
        continue;
      }
      if (i >= 2) {
        d[i][j] += d[i - 2][j] * ((i * (i - 1)) / 2);
        d[i][j] %= mod;
      }
      if (j >= 2) {
        d[i][j] += d[i + 2][j - 2] * ((j * (j - 1)) / 2);
        d[i][j] %= mod;
      }
      if (i + j >= 2) {
        d[i][j] += d[i][j - 1] * i * j;
        d[i][j] %= mod;
      }
    }
  }
  cout << d[cnt1][cnt2] << endl;
  return 0;
}
