Under construction

Still being built. Things may change

Gahui and Soongsil University Station

Time limit1sMemory limit1024 MB

Summary
Sum the vertical drop in cm from the exit to the B6 platform, using stairs at 17cm each and escalator steps at 21cm each.
Level

Easy2 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Soongsil University Station is known as the deepest station on Seoul Subway Line 7. The platform is on B6. Gahui was surprised that she had not reached the platform after walking down for more than five minutes from the exit. Gahui wants to know how deep Soongsil University Station is. Find the depth of Soongsil University Station.

The depth is the vertical distance from the exit to the platform.

Input

line{floor1}{floor2}
1F1B1
2B1B2
3B2B5
4B5B6

[Table 1] Description of the input

For every two adjacent floors ordered by depth, one line gives the information in one of the following forms.

  • Stair x: If you go down x stairs from the {floor1} floor, you reach the {floor2} floor.
  • Es x: If you go down the escalator with x steps from the {floor1} floor, you reach the {floor2} floor.

Output

Print the answer in cm. If the answer is 5096cm, print 5096.

Constraints

  • The height of one escalator step is 21cm, and the height of one stair is 17cm.
  • The answer is at most 6425.
  • All exits are at the same elevation.
  • All platforms are at the same elevation.
  • There is no change in elevation within the same platform.
  • x is an integer.

Examples1

  1. Example 1

    Input
    Es 20
    Stair 15
    Stair 15
    Stair 15
    
    Expected output
    1185