Seeking treasures of immense value to add to his almighty random knapsack, Prosto is travelling around the world. During one of his journeys he found a room filled with chests, each being locked. On every chest there is a boolean formula engraved on it.
The boolean formulas are sums of multiple clauses, where a clause is the sum of some literals, which can be negated.
Alongside the formula on the chest, there is engraved a number , which represents the number of distinct literals which can appear in the given formula. The -th literal is represented as the -th lowercase letter of the english alphabet e.g. the first literal is 'a', the second literal is 'b' and so on.
In order to unlock a chest you need to find the number of ways to assign each literal or such that the given formula evaluates to .
Let's say we have a chest with variables and the following formula: . If the tuple of literals is equal to one of the following tuples: , , , then the given expression is , so the answer is .
Our protagonist promises you glory and points if you can help him find the keys to some of his chests.
Input
The first line of the input contains , the number of chests.
For each chest you are given a number representing the number of literals, and a string which represents the formula written on the chest.
Output
The output will contain on lines the keys of the chests in the order they appear in the input.
Constraints
- For tests worth points,
- For tests worth more points, there aren't any negated literals
- For tests worth another points,
- The scores from the contest might be different than the scores you get here
Example
stdin
3
4
(c&d)^(!a&b&!c)^(b)
4
(!c)
4
(!c&!d)^(!a&c&!d)^(a&!b&c)
stdout
6
8
8