Aaron is teaching his little brother, Michael, about Pokermon battling! There are two types of Pokermons in the Pokerverse: attacking Pokermons and defending Pokermons. Attacking Pokermons can use attacks to deal damage to defending Pokermons. Each attacking Pokermon has an $$$\textit{Atk}$$$ value and can use four attacks. An attack has a base power that determines how much damage the attack will deal (referred to as $$$\textit{BP}$$$ below) and one of five elemental types (Fire, Water, Grass, Electric, or Ground). The damage dealt by an attack is proportional to both the $$$\textit{Atk}$$$ of the attacking Pokermon and the $$$\textit{BP}$$$ of the attack.
Defending Pokermons, on the other hand, cannot deal damage. Instead, they have a $$$\textit{Def}$$$ value, which is inversely proportional to the damage received, and an elemental type (also one of Fire, Water, Grass, Electric, or Ground). The elemental types of the attack used and the defending Pokermon affect how much damage is dealt. A $$$\textit{TypeEffectiveness}$$$ value is assigned for each pair of elemental types, and the damage dealt will be multiplied by the $$$\textit{TypeEffectiveness}$$$ of the two types. Below is a chart of $$$\textit{TypeEffectiveness}$$$ between all pairs of elemental types:

For example, the damage dealt by Fire-type attacks towards Water-type defending Pokermons will be halved (as Fire-type attacks have a $$$\textit{TypeEffectiveness}$$$ of $$$\frac{1}{2}$$$ towards Water-type defending Pokermons). Electric-type attacks will deal no damage to Ground-type defending Pokermons.
In summary, the damage that an attacking Pokermon can deal with a certain attack is calculated as follows:
$$$\textit{Damage} = \textit{BP} \times \frac{\textit{Atk}}{\textit{Def}} \times \textit{TypeEffectiveness}$$$,
As deciding on the best Pokermon and attack to use is the key to success in Pokermon battling, Aaron prepared a challenge for Michael: he will first give Michael $$$N$$$ attacking Pokermons, providing him with their $$$\textit{Atk}$$$ value, along with the $$$\textit{BP}$$$ and the elemental type for each of the four attacks they can use. Then, he will ask Michael $$$Q$$$ questions in the following way: he will specify a defending Pokermon's $$$\textit{Def}$$$ value and elemental type. Given that Michael can choose one Pokermon from his $$$N$$$ attacking Pokermons and use one of its attacks, what is the maximum damage that can be dealt to this defending Pokermon?
The first line of the input consists of two integers $$$N$$$ $$$(1 \leq N \leq 2 \times 10^4)$$$ and $$$Q$$$ $$$(1 \leq Q \leq 2 \times 10^4)$$$, representing the number of Pokermons Aaron gave Michael and the number of questions Aaron asked Michael.
Then, $$$N$$$ groups of input follow with the following format:
$$$Q$$$ lines of input then follow: the $$$i^{th}$$$ line consists of a character $$$T_i$$$ and an integer $$$D_i$$$ $$$(1 \leq D_i \leq 1000)$$$, representing the elemental type and the $$$\textit{Def}$$$ value of the $$$i^{th}$$$ defending Pokermon. $$$T_i$$$ will be one of F (Fire), W (Water), L (Grass), E (Electric), or G (Ground).
The output should consist of $$$Q$$$ lines, each consisting of one floating point number. The $$$i^{th}$$$ number should be the maximum damage that can be dealt to the $$$i^{th}$$$ defending Pokermon. Your answer will be considered correct with absolute or relative error less than $$$10^{-6}$$$.
2 110F 10W 10L 10G 1015F 5W 6L 7G 8E 10
24.0000000000
3 33F 22E 29G 9F 2816F 19W 17L 19W 179E 30W 4W 9E 11G 27F 31W 7
22.5185185185 17.5483870968 86.8571428571
For Sample 1, there is only one defending Pokermon with Electric type and a $$$\textit{Def}$$$ value of $$$10$$$. The four attacks of the first attacking Pokermon will deal $$$10$$$, $$$10$$$, $$$10$$$, and $$$20$$$ damage to the defending Pokermon respectively, and the four attacks of the second attacking Pokermon will deal $$$7.5$$$, $$$9$$$, $$$10.5$$$, and $$$24$$$ damage to the defending Pokermon respectively. Therefore, the maximum amount of damage that can be dealt is $$$24$$$.
| Name |
|---|


