#C9558. Calculate Character Speed with Encumbrance

    ID: 53664 Type: Default 1000ms 256MiB

Calculate Character Speed with Encumbrance

Calculate Character Speed with Encumbrance

Given a character's race and level of encumbrance, calculate the character's speed in feet per round. The base speeds for each race are as follows:

  • Human: 30 feet/round
  • Elf: 35 feet/round
  • Dwarf: 25 feet/round
  • Halfling: 25 feet/round

The encumbrance modifiers are:

  • Light: 0 feet
  • Medium: -10 feet
  • Heavy: -20 feet

The final speed is calculated as follows:

\( \text{Final Speed} = \max(0, \text{Base Speed} + \text{Modifier}) \)

You need to implement a program that reads the character's race and encumbrance from standard input and prints the computed final speed to standard output.

inputFormat

The input consists of two lines:

  1. The first line is a string representing the character's race (one of Human, Elf, Dwarf, or Halfling).
  2. The second line is a string representing the encumbrance type (one of Light, Medium, or Heavy).

outputFormat

Output a single integer representing the character's final speed in feet per round after applying the encumbrance modifier. If the calculated speed is less than 0, output 0.

## sample
Human
Light
30