#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N = 3005, M = 30000 + 10;
int n, m, mod;
int cur[N], dp[2][505][505];
int main() {
  scanf("%d%d%d", &n, &m, &mod);
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      int t;
      scanf("%1d", &t);
      if (t) cur[j]++;
    }
  }
  m = n - m;
  bool d = 0;
  dp[!d][m][0] = 1;
  for (int i = 1; i <= n; i++, d = !d) {
    if (cur[i] == 2) {
      d = !d;
      continue;
    }
    memset(dp[d], 0, sizeof(dp[d]));
    if (cur[i] == 1) {
      for (int j0 = 0; j0 <= m; j0++)
        for (int j1 = 0; j1 <= m; j1++) {
          int j2 = m - j0 - j1;
          if (j2 < 0 || j2 > m) continue;
          if (!dp[!d][j0][j1]) continue;
          if (j0 && j1 != m) {
            (dp[d][j0 - 1][j1 + 1]) =
                ((dp[d][j0 - 1][j1 + 1]) + (1ll * j0 * dp[!d][j0][j1] % mod)) %
                mod;
          };
          if (j1) {
            (dp[d][j0][j1 - 1]) =
                ((dp[d][j0][j1 - 1]) + (1ll * j1 * dp[!d][j0][j1] % mod)) % mod;
          }
        }
    } else if (cur[i] == 0) {
      for (int j0 = 0; j0 <= m; j0++)
        for (int j1 = 0; j1 <= m; j1++) {
          int j2 = m - j0 - j1;
          if (j2 < 0 || j2 > m) continue;
          if (!dp[!d][j0][j1]) continue;
          if (j0) {
            (dp[d][j0 - 1][j1]) =
                ((dp[d][j0 - 1][j1]) +
                 (1ll * j0 * j1 % mod * dp[!d][j0][j1] % mod)) %
                mod;
          };
          if (j0 >= 2 && j1 + 2 <= m) {
            (dp[d][j0 - 2][j1 + 2]) =
                ((dp[d][j0 - 2][j1 + 2]) +
                 (1ll * j0 * (j0 - 1) / 2 % mod * dp[!d][j0][j1] % mod)) %
                mod;
          };
          if (j1 >= 2) {
            (dp[d][j0][j1 - 2]) =
                ((dp[d][j0][j1 - 2]) +
                 (1ll * j1 * (j1 - 1) / 2 % mod * dp[!d][j0][j1] % mod)) %
                mod;
          };
        }
    }
  }
  cout << dp[!d][0][0] << endl;
}
