#include <bits/stdc++.h>
using namespace std;
const int N = 510;
int B;
int n, m;
char s[N][N];
long long dp[2][N][N];
long long (*dp1)[N];
long long (*dp2)[N];
int main() {
  scanf("%d%d%d", &n, &m, &B);
  for (int i = 1; i <= m; ++i) {
    scanf("%s", s[i] + 1);
  }
  int cnt[3] = {0, 0, 0};
  for (int j = 1; j <= n; ++j) {
    int c = 0;
    for (int i = 1; i <= m; ++i) {
      if (s[i][j] == '1') c++;
    }
    cnt[c]++;
  }
  dp[0][cnt[0]][cnt[1]] = 1;
  dp1 = dp[0];
  dp2 = dp[1];
  for (int i = m; i < n; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int k = 0; k <= n; ++k) {
        if (dp1[j][k]) {
          if (j >= 1 && k >= 1)
            dp2[j - 1][k] = (dp2[j - 1][k] + dp1[j][k] * j * k) % B;
          if (j >= 2)
            dp2[j - 2][k + 2] =
                (dp2[j - 2][k + 2] + dp1[j][k] * (j * (j - 1) / 2)) % B;
          if (k >= 2)
            dp2[j][k - 2] = (dp2[j][k - 2] + dp1[j][k] * (k * (k - 1) / 2)) % B;
        }
      }
    }
    swap(dp1, dp2);
  }
  printf("%I64d\n", dp1[0][0]);
  return 0;
}
