#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    ll mod;
    cin >> n >> m >> mod;
    vector<int> cnt(n);
    for (int i = 0; i < m; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < n; j++)
            cnt[j] += s[j] == '1';
    }
    int z = count(cnt.begin(), cnt.end(), 0), r = n - m;
    vector<ll> dp(n + 1), next(n + 1);
    dp[z] = 1;
    for (; r > 0; r--) {
        fill(next.begin(), next.end(), 0);
        for (int zero = 0; zero <= n; zero++)
            if (dp[zero]) {
                int one = 2 * r - 2 * zero;
                if (one < 0 || one + zero > n)
                    continue;
                auto add = [&](int nz, ll ways) {
                    next[nz] = (next[nz] + dp[zero] * (ways % mod)) % mod;
                };
                if (zero >= 2)
                    add(zero - 2, 1LL * zero * (zero - 1) / 2);
                if (zero && one)
                    add(zero - 1, 1LL * zero * one);
                if (one >= 2)
                    add(zero, 1LL * one * (one - 1) / 2);
            }
        dp.swap(next);
    }
    cout << dp[0] << '\n';
}
