Under construction

Still being built. Things may change

Gahee and Club Audition 1

Time limit1sMemory limit512 MB

Summary
Given a key note level and its judgement, compute the score when the judgement differs from the previous one, so a perfect starts a 1-chain.
Level

Easy2 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Gahee plays a club audition game. The game has several modes, and Gahee plays the 8-key mode. The 8-key mode has key notes with level 6 or higher. A key note of level lvlv has lvlv keys. Each key points in one of 8 directions: up, down, left, right, up-left, down-left, up-right, or down-right.

[Figure 1] A key note of level 6

[Figure 1] has four pictures. Yellow marks a key that has already been pressed, and blue marks a key that must be pressed. For example, the upper right picture in Figure 1 means the keys must be pressed in the order down-left, right, up-right, down.

The upper left picture in the first row shows the moment right after a level 6 key note appears. The upper right picture shows the state 1/4 of the timing after the note appears. The lower left picture shows the state 1/2 of the timing after the note appears, and by then all six keys have been pressed. The lower right picture shows Gahee pressing the Space key on the timing and earning a perfect judgement.

Each key note receives a judgement. Two cases produce a miss judgement:

  • Fewer than lvlv directions were entered correctly.
  • The Space key was not pressed, or it was pressed but the timing was off.

Otherwise, the judgement is one of bad, cool, great, or perfect. A perfect judgement also has one more state, the nn-chain (n-pack). The nn-chain is the state of receiving nn perfect judgements in a row. When a key note gets a perfect judgement:

  • If the previous judgement was not perfect, the state is a 1-chain.
  • If the previous judgement was perfect and the state was a kk-chain, the state becomes a (k+1)(k+1)-chain.

The score for a key note of level lvlv depends on its judgement:

  • miss gives 0 points.
  • bad gives 200200 times lvlv points.
  • cool gives 400400 times lvlv points.
  • great gives 600600 times lvlv points.
  • perfect in an nn-chain gives n⋅lvn \cdot lv times 1 0001\,000 points.

The level lvlv and the judgement of a key note that Gahee hit are given. Find the score Gahee earned when the judgement is different from the one Gahee received before.

Input

The first line contains the level lvlv of the key note and the judgement, separated by a space. The judgement is one of miss, bad, cool, great, or perfect.

Output

Print the score Gahee earned.

Constraints

  • 6≤lv≤116 \le lv \le 11

Examples2

  1. Example 1

    Input
    6 miss
    
    Expected output
    0
    
  2. Example 2

    Input
    7 perfect
    
    Expected output
    7000