URI Online Judge | 2141

P4 Simplified

By Joao Marcos Salvanini Bellini de Moraes, IFSULDEMINAS BR Brazil

Timelimit: 1

You, fan of "The True Goddess Reincarnation" video game franchise, were hired by the developer company ATULS to help make a simplified version of the video game Personality 4, spin-off of this franchise. You'll be responsible for implementing the battle system. The following table contains the available skills and their features:

Skill Type Power HP Cost MP Cost
Effect
MightySwing Physical 270 14% - -
GiganticFist Physical 560 16% - -
RainyDeath Physical 350 20% - -
Agilao Magic - Fire
200 - 8 -
Agidyne Magic - Fire
320 - 12 -
Bufula Magic - Ice
200 - 8 -
Bufudyne Magic - Ice
320 - 12 -
Megidola Magic
360 - 32 -
Megidolaon Magic
420 - 60 -
BlackViper Magic
440 - 64 -
Tarukaja Support - - 12 Attacker's current phys attack increases 25% and remains active until he uses phys attack
Rakukaja Support
- - 12 Attacker's current defense increases 25% and remains active until he suffers any attack
Tarunda Support
- - 12 Defender's current phys attack decreases 25% and remains active until he uses phys attack
Rakunda Support
- - 12 Defender's current defense decreases 25% and remains active until he suffers any attack

Note: Support skills don't stack and always consume MP, even if it has no effect anymore. For example, if the player uses Rakunda 5 times in a row, the defender's DEF will still be 25% smaller and the MP consumption will have been 60.

In order to test the functionality of this system, you must consider a battle 1 vs. 1. Each battler will have level, HP (health points), MP (magic points) and the stats ATK (physical attack), MAG (magic attack) and DEF (general defense). The damage formula is:

AT = Current attacker's attack. If physical attack, replace it with ATK, if magic attack, replace it with MAG.
DF = Current defender's defense, that is, the DEF stat.
P = Attack's power.
DIFF = Difference between the current attacker's level and the current defender's level. This value will not be smaller than -10 neither greater than 10.

Input

The input consists of a single test case. The first line contains the name of the battler 1 and the second line, his level (integer: 1 ≤ N ≤ 99), HP, MP (floating point: 1 ≤ HP, MP ≤ 999), ATK, MAG and DEF (floating point: 1 ≤ ATK, MAG, DEF ≤ 40). The third and the fourth line contains the same as the first and the second line, but related to the battler 2. The first one to attack is the battler 1, that is, in the first turn, the battler 1 is the current attacker and the battler 2 is the current defender. In the second turn, the battler 2 is the attacker and the battler 1 is the defender. The same logic applies to the subsequent turns. Read input until the battler X's HP reaches 0 or drops below 0.

Output

As soon as the battler X's HP reaches 0 or drops below 0, print "X is dead." then in the next line, the surviving battler's HP, MP, ATK, MAG and DEF.

Input Samples Output Samples

Daisoujou

25 200 100 28 12 20

Matador

22 250 89 35 10 30

MightySwing

Megidolaon

Tarukaja

RainyDeath

GiganticFist

Matador is dead.

Daisoujou HP: 29.11, MP: 88.00, ATK: 28.0, MAG: 12.0, DEF: 20.0

Chie

1 1 1 1 1 1

Shadow

1 1 1 1 1 1

Tarunda

MightySwing

Chie is dead.

Shadow HP: 0.86, MP: 1.00, ATK:1.0, MAG: 1.0, DEF: 1.0