You are given a binary string of length $n$. You can merge $k$ adjacent characters into a new character and gain a certain score. The resulting character and the score are determined by these $k$ characters. You need to find the maximum score you can obtain.
Input
The first line contains two integers $n$ and $k$.
The next line contains a binary string of length $n$, representing the initial string.
The next $2^k$ lines each contain a character $c_i$ and an integer $w_i$, where $c_i$ is the resulting character obtained from the $i$-th merging scheme (corresponding to the $i$-th binary string of length $k$ when sorted in ascending order), and $w_i$ is the score obtained from that scheme.
Output
Output a single integer representing the answer.
Examples
Input 1
3 2 101 1 10 1 10 0 20 1 30
Output 1
40
Note
The 3rd to 6th lines represent the 4 merging schemes for binary strings of length 2. $00 \to 1$ gives 10 points, $01 \to 1$ gives 10 points, $10 \to 0$ gives 20 points, and $11 \to 1$ gives 30 points.
Constraints
| Data ID | $n$ | $k$ | $w_i$ |
|---|---|---|---|
| 0 | $=10$ | $2$ | $\le 10^5$ |
| 1 | $=15$ | $3$ | $\le 10^5$ |
| 2 | $=20$ | $4$ | $\le 10^5$ |
| 3 | $=25$ | $5$ | $\le 10^5$ |
| 4 | $\le 50$ | $5$ | $\le 10^6$ |
| 5 | $\le 50$ | $6$ | $\le 10^6$ |
| 6 | $\le 50$ | $7$ | $\le 10^6$ |
| 7 | $\le 50$ | $8$ | $\le 10^6$ |
| 8 | $\le 100$ | $3$ | $\le 10^7$ |
| 9 | $\le 100$ | $4$ | $\le 10^7$ |
| 10 | $\le 100$ | $5$ | $\le 10^7$ |
| 11 | $\le 100$ | $6$ | $\le 10^7$ |
| 12 | $\le 200$ | $5$ | $\le 10^8$ |
| 13 | $\le 200$ | $6$ | $\le 10^8$ |
| 14 | $\le 200$ | $7$ | $\le 10^8$ |
| 15 | $\le 200$ | $8$ | $\le 10^8$ |
| 16 | $\le 300$ | $5$ | $\le 10^9$ |
| 17 | $\le 300$ | $6$ | $\le 10^9$ |
| 18 | $\le 300$ | $7$ | $\le 10^9$ |
| 19 | $\le 300$ | $8$ | $\le 10^9$ |
For 100% of the data, $n \ge 1$, $0 \le c_i \le 1$, $w_i \ge 1$.