Super Greedy 2#3716

Super Greedy 2

2 seconds
64 megabytes
Very easy

Two players are engaged in a game called "Super Greedy". There are piles, each containing a_i candies. The players take turns, and on each turn, they can remove any number of candies from to from any single pile. The player who removes the last candy from the final pile loses the game. Your task is to determine how many initial moves the first player can make to guarantee a win, assuming both players play optimally.

Input

The first line contains the number of games (1 \le t \le 10^5). Each of the next lines describes a game with three values: (1 \le n \le 5), (1 \le k \le 10), and integers a_i (1 \le a_i \le 10).

Output

For each game, output the number of ways the first player can make an initial move that ensures a win, assuming both players play optimally. If there are no such moves and the first player is destined to lose, output .

Examples

Example 1

Loading
Loading