#include <bits/stdc++.h>
using namespace std;
const long long inf = 2147383647;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
inline long long gcd(long long a, long long b) {
  a = ((a) < 0 ? -(a) : (a));
  b = ((b) < 0 ? -(b) : (b));
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
int ext_gcd(int a, int b, int& x, int& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int d = ext_gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
inline long long modInv(int a, int m) {
  int x, y;
  ext_gcd(a, m, x, y);
  return x;
}
inline long long power(long long a, long long p) {
  long long res = 1, x = a;
  while (p) {
    if (p & 1) res = (res * x);
    x = (x * x);
    p >>= 1;
  }
  return res;
}
inline long long bigmod(long long a, long long p, long long m) {
  long long res = 1, x = a % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
int n, m, mod;
char buf[1010][1010];
long long memo[510][510];
long long dp(int row, int zero, int one) {
  if (row == n) {
    if (zero == 0 && one == 0)
      return 1;
    else
      return 0;
  }
  if (memo[zero][one] != -1) return memo[zero][one];
  long long res = 0;
  if (zero >= 2) {
    res += ((zero * (zero - 1)) / 2) * dp(row + 1, zero - 2, one + 2);
    res %= mod;
  }
  if (zero && one) {
    res += zero * one * dp(row + 1, zero - 1, one);
    res %= mod;
  }
  if (one >= 2) {
    res += ((one * (one - 1)) / 2) * dp(row + 1, zero, one - 2);
    res %= mod;
  }
  memo[zero][one] = res;
  return res;
}
int main() {
  memset(memo, -1, sizeof(memo));
  scanf("%d %d %d", &n, &m, &mod);
  int zero = 0, one = 0;
  for (int i = (0); i <= (m - 1); ++i) {
    for (int j = (0); j <= (n - 1); ++j) {
      scanf(" %c", &buf[i][j]);
    }
  }
  for (int i = (0); i <= (n - 1); ++i) {
    int bit = 0;
    for (int j = (0); j <= (m - 1); ++j) {
      if (buf[j][i] == '1') bit++;
    }
    if (bit == 0)
      zero++;
    else if (bit == 1)
      one++;
  }
  long long res = dp(m, zero, one);
  printf("%I64d\n", res);
  return 0;
}
