#include <bits/stdc++.h>
using namespace std;
long long dp[1000][1000];
char buff[1000][1000];
int main() {
  long long n, m, mod;
  cin >> n >> m >> mod;
  long long x = 0, y = 0;
  for (long long i = 0; i < m; i++) cin >> buff[i];
  for (long long j = 0; j < n; j++) {
    long long count = 0;
    for (long long i = 0; i < m; i++)
      if (buff[i][j] == '1') count++;
    if (count == 0)
      x++;
    else if (count == 1)
      y++;
  }
  dp[x][y] = 1;
  for (x = 990; x >= 0; x--)
    for (y = 990; y >= 0; y--) {
      if (x >= 2)
        dp[x - 2][y + 2] =
            (dp[x - 2][y + 2] + dp[x][y] * (x) * (x - 1) / 2 % mod) % mod;
      if (x >= 1 && y >= 1)
        dp[x - 1][y] = (dp[x - 1][y] + dp[x][y] * (x) * (y) % mod) % mod;
      if (y >= 2)
        dp[x][y - 2] =
            (dp[x][y - 2] + dp[x][y] * (y) * (y - 1) / 2 % mod) % mod;
    }
  cout << dp[0][0];
  return 0;
}
