#include <bits/stdc++.h>
using namespace std;
int one[507], visit[3][507][507], vv;
long long dp[3][507][507];
vector<pair<int, int> > vec[3];
int main() {
  int now = 0, pre = 1, n, m, a_inp, mod;
  scanf("%d %d %d", &n, &m, &mod);
  for (int j = 0; j < m; j++)
    for (int i = 0; i < n; i++) {
      scanf("%1d", &a_inp);
      one[i] += a_inp;
    }
  long long on = 0, tw = 0, tp;
  for (int i = 0; i < n; i++) {
    if (one[i] == 0)
      tw++;
    else if (one[i] == 1)
      on++;
  }
  vec[now].push_back(make_pair(on, tw));
  dp[now][on][tw] = 1;
  for (int i = m; i < n; i++) {
    swap(now, pre);
    vv++;
    vec[now].clear();
    for (int j = 0; j < vec[pre].size(); j++) {
      on = vec[pre][j].first;
      tw = vec[pre][j].second;
      if (on > 1) {
        if (visit[now][on - 2][tw] != vv) {
          visit[now][on - 2][tw] = vv;
          dp[now][on - 2][tw] = 0;
          vec[now].push_back(make_pair(on - 2, tw));
        }
        tp = (on * (on - 1)) / 2LL;
        tp = tp % mod;
        tp = tp * dp[pre][on][tw];
        tp = tp % mod;
        dp[now][on - 2][tw] += tp;
        dp[now][on - 2][tw] %= mod;
      }
      if (tw > 1) {
        if (visit[now][on + 2][tw - 2] != vv) {
          visit[now][on + 2][tw - 2] = vv;
          dp[now][on + 2][tw - 2] = 0;
          vec[now].push_back(make_pair(on + 2, tw - 2));
        }
        tp = (tw * (tw - 1)) / 2LL;
        tp = tp % mod;
        tp = tp * dp[pre][on][tw];
        tp = tp % mod;
        dp[now][on + 2][tw - 2] += tp;
        dp[now][on + 2][tw - 2] %= mod;
      }
      if (tw > 0 && on > 0) {
        if (visit[now][on][tw - 1] != vv) {
          visit[now][on][tw - 1] = vv;
          dp[now][on][tw - 1] = 0;
          vec[now].push_back(make_pair(on, tw - 1));
        }
        tp = on * tw;
        tp = tp % mod;
        tp = tp * dp[pre][on][tw];
        tp = tp % mod;
        dp[now][on][tw - 1] += tp;
        dp[now][on][tw - 1] %= mod;
      }
    }
  }
  printf("%lld\n", dp[now][0][0]);
  return 0;
}
