#z1024. 01串(binary)

01串(binary)

Description

image

Format

Input

image

Output

输出一行一个整数表示答案。

Samples

3
1 0 2
1 0
1
6
3
1 1 2
1 0
1
2
3
1 2 1
1 0
1
0
3
2 0 2
0 1
1
0

大样例:binary5.in binary5.ans

Limitation

image

1s, 512MiB for each test case.