You are given a binary string of length and an array of integers of length .
You need to choose two indices and such that i < j, s_i = 0, s_j = 1, and a_i < a_j, and maximize the value of a_i + a_j.
Output the maximum possible value of a_i + a_j. If no such pair of indices exists, output .
The first line contains one integer (1 \le n \le 3 \cdot 10^5) — the length of the string and the array .
The second line contains a binary string of length . Each character of the string is either or .
The third line contains integers a_1, a_2, \ldots, a_n (1 \le a_i \le 10^9).
Output one integer — the maximum possible value of a_i + a_j among all pairs of indices i < j such that s_i = 0, s_j = 1, and a_i < a_j.
If no such pair exists, output .
Example 1
Example 2
In the example, you can choose indices i=3 and j=4.
For them, i<j, s_i=0, s_j=1, and a_i<a_j hold.
The sum of the corresponding elements is a_3+a_4=3+4=7.
It is impossible to obtain a larger sum, so the answer is .
Subtask ( points): there exists an index such that s_i=0 for all i \le p and s_i=1 for all i>p.
Subtask ( points): n \le 1000.
Subtask ( points): No additional constraints.