Calculus Simplified We define an expression as below:

< expression > := < number > | < expression >+< expression > | < expression >-< expression > | (< expression >) where number is defined to be an integer. In this problem you are given an expression with all its numbers replaced with character ‘x’. Then you are given a set of numbers that were actually in the expression. We know that numbers were placed in the expression in such a way that the expression evaluates to maximum possible value among all other placements. Write a program that calculates this maximum value. Input In the first line there is an integer T (T ≤ 100), the number of tests. Each test begins with the expression itself. Next line is an integer N, the number of numbers in the expression. In the final line of each test there are N integers ai (|ai| ≤ 3000). Each of these numbers should be used in the expression exactly once. It is guaranteed that the expression can be parsed by the definition in the problem statement and its length will not exceed 105. There are no whitespaces in the expression and all numbers are replaced with a single ‘x’. The number of ‘x’s in the expression is N. Output For each test output the maximum possible value of the expression in a single line. Sample Input 3 x 1 2 x-x 2 -1 1 (x)+(x)-(x) 3 111 Sample Output 2 2 1