#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, m, mod;
  cin >> n >> m >> mod;
  vector<int> num(n + 1, 2);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      cin >> c;
      if (c == '1') num[j + 1]--;
      if (num[j + 1] < 0) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  long long stan[505][505][2];
  for (int i = 0; i <= 500; i++) {
    for (int j = 0; j <= 500; j++) {
      stan[i][j][0] = stan[i][j][1] = 0;
    }
  }
  stan[0][n - m][0] = 1;
  for (int i = 1; i <= n; i++) {
    if (num[i] == 0) continue;
    for (long long j = 0; j <= n - m; j++) {
      for (long long k = 0; k <= n - m; k++) {
        if (stan[j][k][0] == 0) continue;
        if (num[i] == 1) {
          if (j - 1 >= 0) stan[j - 1][k][1] += (stan[j][k][0] * j) % mod;
          if (k - 1 >= 0) stan[j + 1][k - 1][1] += (stan[j][k][0] * k) % mod;
        } else if (num[i] == 2) {
          if (j - 2 >= 0)
            stan[j - 2][k][1] +=
                (stan[j][k][0] * (j * (j - 1) / 2ll) % mod) % mod;
          if (k - 2 >= 0)
            stan[j + 2][k - 2][1] +=
                (stan[j][k][0] * (k * (k - 1) / 2ll) % mod) % mod;
          if (k - 1 >= 0 && j > 0)
            stan[j][k - 1][1] += ((stan[j][k][0] * j) % mod * k) % mod;
        }
      }
    }
    for (int j = 0; j <= n - m; j++) {
      for (int k = 0; k <= n - m; k++) {
        stan[j][k][0] = stan[j][k][1];
        stan[j][k][1] = 0;
      }
    }
  }
  cout << stan[0][0][0] << endl;
}
