'
URI Online Judge | 1836

Pokémon!

Por Edson Alves, Faculdade UnB Gama BRBrazil

Timelimit: 1

In the first generation, the creatures from the Pokémon game have four basic attributes: hit points (HP), attack (AT), defense (DF) and speed (SP). These attributes increased as the pokémon gained experience levels winning battles or using special itens.

For each level (from 1 to 99) the value of the attributes can be computed by the following expressions:

e

where BS is the base value of the attribute (hit points, attack, defense and speed), EV is the effort value of the pokémon (it depends on what and how many battles the pokémon entered), IV is the individual value of the pokémon in the given attribute (it is the pokémon "gene") and L is the level.

The EV and IV values differentiate two pokémons of same kind, making both evolutions differ. Each attribute must have a integer value: the decimal value must be discarded after the fraction computation.

Given a pokémon, its basic attributes values and level, compute the attributes values according to the expressions.

Input

The input consists of a series of test cases. The number of test cases T (T ≤ 1.000) is given in the first line of the input.

Each test case is composed by five lines. The first one contains the pokémon name P and its level L (1 ≤ L ≤ 99), separated by a single space. The pokémon's name has only alphanumeric characteres.

The following lines have three integers each: BS (1 ≤ BS ≤ 255), IV (1 ≤ IV ≤ 15) e EV (1 ≤ EV ≤ 262.140), separated by a single space, for each one of the attributes, in this order: HP, AT, DF e SP.

Output

For each test case the output is formed by five messages, one per line:

  1. Caso #t: P nivel L
  2. HP: HPC
  3. AT: ATC
  4. DF: DFC
  5. SP: SPC
where P is the pokémon's name, L the level and SC the attribute value for level L, according to given expressions, and t is the test case number.

Input Samples Output Samples

4

Pikachu 81

35 7 22850

55 8 23140

30 13 17280

90 5 24795

Bulbasaur 50

45 9 20000

49 12 40000

49 3 60000

45 8 10000

Charmander 30

39 5 35000

52 14 60000

43 7 38000

65 15 200000

Squirtle 90

44 10 180000

48 2 220000

65 11 175000

43 8 192000

Caso #1: Pikachu nivel 81

HP: 189

AT: 137

DF: 101

SP: 190

Caso #2: Bulbasaur nivel 50

HP: 131

AT: 91

DF: 87

SP: 70

Caso #3: Charmander nivel 30

HP: 80

AT: 62

DF: 49

SP: 86

Caso #4: Squirtle nivel 90

HP: 292

AT: 200

DF: 235

SP: 195