问题 I: We Love Strings

内存限制:256 MB 时间限制:3 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:6 通过:3

题目描述

链接:https://ac.nowcoder.com/acm/contest/57361/I
来源:牛客网
We have n strings sis_isi which only contain 01?\texttt{01?}01?. ?\texttt{?}? means it can match either 000 or 111.
You need to find how many 010101 strings are there which matches at least one of these strings.

输入格式

The first line contains one integer n(1≤n≤400)n(1\leq n\leq 400)n(1n400) .
The next nnn lines, the iii-th line contains a string si(1≤∑∣si∣≤400)s_i(1\leq \sum|s_i|\leq 400)si(1si400).

输出格式

Output the answer modulo 998244353998244353998244353 in one line.

输入样例 复制

3
10?
?0?
?11

输出样例 复制

6