#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e3;
int n, m, mod;
bool mark[maxN];
long long a[maxN][maxN];
void dp(int cnt1, int cnt0) {
  if (a[cnt1][cnt0] != -1) return;
  a[cnt1][cnt0] = 0;
  if (cnt1 == 0 && cnt0 == 0) {
    a[cnt1][cnt0] = 1;
    return;
  }
  if (cnt1 >= 2) {
    dp(cnt1 - 2, cnt0);
    a[cnt1][cnt0] +=
        (long long)a[cnt1 - 2][cnt0] * (cnt1 * (cnt1 - 1) / 2) % mod;
    a[cnt1][cnt0] %= mod;
  }
  if (cnt0 >= 2) {
    dp(cnt1 + 2, cnt0 - 2);
    a[cnt1][cnt0] +=
        (long long)a[cnt1 + 2][cnt0 - 2] * (cnt0 * (cnt0 - 1) / 2) % mod;
    a[cnt1][cnt0] %= mod;
  }
  if (cnt1 >= 1 && cnt0 >= 1) {
    dp(cnt1, cnt0 - 1);
    a[cnt1][cnt0] += (long long)a[cnt1][cnt0 - 1] * cnt1 * cnt0 % mod;
    a[cnt1][cnt0] %= mod;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> mod;
  int cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < n; j++) {
      if (s[j] == '1') {
        if (mark[j]) {
          cnt2++;
          cnt1--;
        } else {
          cnt1++;
          mark[j] = true;
        }
      }
    }
  }
  memset(a, -1, sizeof a);
  dp(cnt1, n - cnt1 - cnt2);
  cout << a[cnt1][n - cnt1 - cnt2] % mod << endl;
}
