Video Game Club has begun a Pokemon Nuzlocke, and they're stuck on a particularly hard Pokemon of type
Luckily for you, they're playing a simplified modded version of the game! In their mod, Pokemon can have
In their mod, Fire type moves deal double their base damage to Grass type Pokemon, half their base damage rounded down to Water type Pokemon, and exactly their base damage (neutral) to Fire type Pokemon. Similarly, Water type moves deal double their base damage to Fire type Pokemon, half rounded down to Grass type Pokemon, and neutral (exactly the base damage) to other Water type Pokemon. Grass type moves deal double damage to Water types, half rounded down to Fire types, and neutral (exactly the base damage) to other Grass types.
Can you determine the maximum damage they can deal to the enemy Pokemon with a single move?
Constraints
Subtask 1 [25%]
Subtask 2 [25%]
All moves are the same type as
Subtask 3 [50%]
No additional constraints.
Input Specification
The first line contains the string FIRE
, WATER
, or GRASS
).
The second line contains the integer
The next FIRE
, WATER
, or GRASS
) for move
Output Specification
The output consists of one integer, the maximum damage any single move can deal to the enemy Pokemon.
Sample Input
FIRE
5
3 FIRE
2 WATER
6 GRASS
3 GRASS
4 FIRE
Sample Output
4
Explanation for Sample
The second and fifth moves each deal
Index | Base Damage | Dealt Damage |
---|---|---|
1 | 3 | 3 |
2 | 2 | 4 |
3 | 6 | 3 |
4 | 3 | 1 |
5 | 4 | 4 |
Comments