Proteins are large organic molecules made of amino acids arranged in a linear chain and joined by peptide bonds. The amino acids in the chain and the order in which they appear determine the physical and chemical properties of the protein. There are 20 standard amino acids, each identified by a unique 3-letter code (for example, Ala for Alanine).
Two scientists have built a machine that rearranges chains of amino acids, effectively converting one protein into another. This lets them turn organic waste into useful substances such as insulin.
The chemical processes that break and create peptide bonds are expensive, and every amino-acid chain must be processed separately. Your task is to compute the cost of transforming one chain of amino acids into another.
The costs are as follows.
The amino acids Lysine (Lys), Valine (Val), Arginine (Arg) and Histidine (His) are rare and more expensive: adding one of these, or replacing an amino acid with one of these, costs 1 euro more than the normal operation (so inserting a rare amino acid costs 5 euros and replacing with a rare amino acid costs 6 euros). You may assume unlimited supplies of every amino acid. Leaving an amino acid unchanged, where the two chains already agree at that position, costs nothing.
The first line contains an integer n (0 < n ≤ 10000), the number of test cases. Each test case is given as follows.
Within a single test case, at most 20 different amino acid types appear.
For each test case, print a single line with one integer: the minimum cost (in euros) of converting the chain (x1, x2, …, xk) into the chain (y1, y2, …, ym).