P17155 [ICPC 2017 Xi'an R] LOL
Description
$5$ friends play LOL together. Everyone should BAN one character and PICK one character. The enemy should BAN $5$ characters and PICK $5$ characters. All these $20$ heroes must be different.
Everyone can BAN any heroes by their personal wishes. But they can only PICK heroes which they have bought.
Suppose the enemy can PICK or BAN any heroes. How many different ways are there satisfying the conditions?
For example, a valid way is:
- Player $1$: picks hero $1$, bans hero $2$
- Player $2$: picks hero $3$, bans hero $4$
- Player $3$: picks hero $5$, bans hero $6$
- Player $4$: picks hero $7$, bans hero $8$
- Player $5$: picks hero $9$, bans hero $10$
Enemies pick heroes $11, 12, 13, 14, 15$, ban heroes $16, 17, 18, 19, 20$.
Input Format
The input contains multiple test cases (no more than $20$).
In each test case, there are $5$ strings $S[1] \sim S[5]$, respectively whose lengths are $100$. For the $i$-th person, if he has bought the $j$-th hero, the $j$-th character of $S[i]$ is '$1$', or '$0$' if not. The total number of heroes is exactly $100$.
Output Format
For each test case, print the answer mod $1000000007$ in a single line.