
125  The 13th Zhejiang University Programming Contest  B
DescriptionA little kid loves to write digits in LC display style, but he would like to put two consecutive digits very close to each other. Sometimes, that makes the number he writes ambiguous. In LC display style, each digit is written as below:
As the table shown above, in LC display style, each digit is written in 3 rows and 3 columns. The little kid always overlaps the last column of the previous digit and the first column of the next digit. Please help his parents to count the number of different ways to translate the weird 'image'. InputThere are multiple test cases. The first line of input contains an integer T (T ≤ 1500) indicating the number of test cases. Then T test cases follow. The first line of each case contains one integer: n (n ≤ 10^{4})  the number of digits that the little kid writes. Then each of the following 3 lines contains exactly 2n+1 characters  represents the number written by the kid. OutputFor each test case, print a single number  the number of ways to express the badwritten 'image' module 10^{9}+7 (which is equivalent to print answer % 1000000007, where % is the module operator in all major programming languages).Sample Input6 1   1 _ _ _ 1   1 _ _ _ 2 _ _ _ 2 _ _ __ _ _ Sample Output0 0 1 1 3 1 HintSometimes, the little kid may make some mistakes, in which case you should output 0. It's forbidden to miss anything or change the character's position (it should be exactly the same as the table shown above). So the answers of the first two cases are 0s. The third case can be translated in 3 ways: 13, 18, 19. 