# Debugging Dilemma

Easy
3
19.4% Acceptance

In the latest update by Codedamn Labs, a unique functionality was rolled out, designed to pinpoint the exact test case where your code might be stumbling. Imagine you've made a submission for a challenge, and it doesn't pass muster. Now, with just a click on the "Analyze My Solution" button, you can unveil the smallest test case that tripped your code.

Your task is to identify the minimum-sized test case your code fails to solve correctly. You're provided with $N$ test cases, each with a specified size $S_1, S_2, \ldots, S_N$. Alongside, a binary string $V$ is given, indicating the success or failure of your submission on these test cases: a '1' for a pass and a '0' for a fail. Your objective is to find and report the size of the smallest test case where your code did not succeed.

## Input Format

• The first line will have an integer $T$, the number of test cases.
• For each test case, the input is as follows:
• A single integer $N$ on the first line.
• On the next line, $N$ integers representing the sizes $S_1, S_2, \ldots, S_N$.
• The third line holds a binary string $V$.

## Output Format

Output a single integer per test case, denoting the size of the smallest failing test case, each on a new line.

## Constraints

• $1 \leq T \leq 100$
• $1 \leq N \leq 100$
• $1 \leq S_i \leq 100$
• $V$ has a length of $N$
• $V$ consists of '0's and '1's
• At least one '0' is present in $V$

## Sample Test Cases

### Case #1:

Input:

5
3
5 10 3
000
3
5 10 3
001
3
5 5 3
001
3
5 5 3
101
5
10 100 100 10 10
00001

Output:

3
5
5
5
10

#### Explanation

Test case 1: The submission fails all $3$ test cases with sizes $\{5, 10, 3\}$. The smallest size among these is $3$, hence the output is $3$.

Test case 2: Out of $3$ test cases, the submission fails $2$ with sizes $\{5, 10\}$. The smallest size is $5$, leading to the output $5$.

Test case 3: Here, the submission fails $2$ test cases, both of size $5$. Thus, the smallest size is $5$.

Test case 4: With only one failed test case of size $5$, the output is straightforwardly $5$.

Test case 5: Among $5$ test cases, the submission fails $4$, with sizes $\{10, 100, 100, 10\}$. The smallest of these is $10$, which is the required output.