#include <bits/stdc++.h>
using namespace std;
int n, m, mod, cnt[505];
char s[505][505];
long long dp[505][505];
inline void add(long long &a, long long b) { a = (a + b) % mod; }
inline long long solve(int a, int b) {
  if (a == 0 && b == 0) return 1;
  if (~dp[a][b]) return dp[a][b];
  long long res = 0;
  if (a >= 2) {
    add(res, (solve(a - 2, b + 2) * 1ll * (a * (a - 1)) / 2) % mod);
  }
  if (b >= 2) {
    add(res, (solve(a, b - 2) * 1ll * (b * (b - 1)) / 2) % mod);
  }
  if (a && b) {
    add(res, (a * (long long)b * solve(a - 1, b - 1 + 1)) % mod);
  }
  return dp[a][b] = res;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d %d %d", &n, &m, &mod);
  for (int i = (0); i <= (m - 1); ++i) {
    scanf("%s", s[i]);
    for (int j = (0); j <= (n - 1); ++j)
      if (s[i][j] == '1') ++cnt[j];
  }
  int a = count(cnt, cnt + n, 0);
  int b = count(cnt, cnt + n, 1);
  cout << solve(a, b) << endl;
}
