#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:133217728")
using namespace std;
long long res[555][555];
long long MOD;
long long cnt(long long n) { return n * (n - 1) / 2; }
long long go(int a, int b) {
  if (!a && !b) return 1;
  if (res[a][b] != -1) return res[a][b];
  long long t = 0;
  if (a > 1) t += cnt(a) * go(a - 2, b + 2) % MOD;
  if (b > 1) t += cnt(b) * go(a, b - 2) % MOD;
  if (a && b) t += a * b * go(a - 1, b) % MOD;
  t %= MOD;
  return res[a][b] = t;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m >> MOD;
  int a = 0, b = 0;
  int cnt[555] = {};
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < s.length(); j++)
      if (s[j] == '1') cnt[j]++;
  }
  for (int i = 0; i < n; i++)
    if (!cnt[i])
      a++;
    else if (cnt[i] & 1)
      b++;
  for (int i = 0; i <= 500; i++)
    for (int j = 0; j <= 500; j++) res[i][j] = -1;
  cout << go(a, b) << endl;
  return 0;
}
