#P10985. [2015杭电多校]Zero Escape

[2015杭电多校]Zero Escape

Zero Escape

Problem Description

Zero Escape, is a visual novel adventure video game directed by Kotaro Uchikoshi (you may hear about ever17?) and developed by Chunsoft. Stilwell is enjoying the first chapter of this series, and in this chapter digital root is an important factor. This is the definition of digital root on Wikipedia: The digital root of a non-negative integer is the single digit value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached. For example, the digital root of 6553665536 is 77, because 6+5+5+3+6=256 + 5 + 5 + 3 + 6 = 25 and 2+5=72 + 5 = 7. In the game, every player has a special identifier. Maybe two players have the same identifier, but they are different players. If a group of players want to get into a door numbered X(1X9)X(1\leq X\leq 9), the digital root of their identifier sum must be XX. For example, players {1,2,6}\{1,2,6\} can get into the door 99, but players {2,3,3}\{2,3,3\} can't. There is two doors, numbered AA and BB. Maybe A=BA=B, but they are two different door. And there is nn players, everyone must get into one of these two doors. Some players will get into the door AA, and others will get into the door BB. For example: players are {1,2,6}\{1,2,6\}, A=9A=9, B=1B=1 There is only one way to distribute the players: all players get into the door 99. Because there is no player to get into the door 11, the digital root limit of this door will be ignored. Given the identifier of every player, please calculate how many kinds of methods are there, mod 258280327mod~258280327.

Input

The first line of the input contains a single number TT, the number of test cases. For each test case, the first line contains three integers nn, AA and BB. Next line contains nn integers idiid_i, describing the identifier of every player. T100T\leq 100, n105n\leq 10^5, n106\sum n\leq 10^6, 1A,B,idi91\leq A,B,id_i\leq 9

Output

For each test case, output a single integer in a single line, the number of ways that these nn players can get into these two doors.

Sample Input

4
3 9 1
1 2 6
3 9 1
2 3 3
5 2 3
1 1 1 1 1
9 9 9
1 2 3 4 5 6 7 8 9

Sample Output

1
0
10
60

Author

SXYZ

Source

2015 Multi-University Training Contest 8