Let's define a value of a string, consisting of letters "XVI", as follows:
You are given a string of characters "XVI?" and asked $$$q$$$ queries about it.
In the $$$i$$$-th query, three integers are provided:
What is the minimum value of the string that can be obtained if all question marks are replaced with the letters 'X', 'V', 'I' so that the number of used letters does not exceed the number of available letters of each type?
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 3 \cdot 10^5$$$) — the length of the string and the number of queries, respectively.
The second line contains a string consisting of $$$n$$$ characters 'X', 'V', 'I' and/or '?'.
The $$$i$$$-th of the following $$$q$$$ lines contains three integers $$$c_X, c_V$$$, and $$$c_I$$$ ($$$0 \le c_X, c_V, c_I \le n$$$) — the number of available letters 'X', 'V' and 'I' in the $$$i$$$-th query.
Additional constraints on the input:
For each query, print a single integer — the minimum value of the string that can be obtained by replacing all question marks with the available letters 'X', 'V', and/or 'I'.
43 3???3 0 02 3 10 1 210 7??IV?VXIV?0 0 44 4 01 1 21 1 31 1 41 2 12 2 09 5?V????IVV9 2 44 1 50 1 44 8 13 2 73 2I?V0 1 00 0 1
309525433627254253191719331795
| Name |
|---|


