#P8534. Calculate Remaining Lives in \(\text{Touhou: Oriental Red Magic} \)

    ID: 21701 Type: Default 1000ms 256MiB

Calculate Remaining Lives in \(\text{Touhou: Oriental Red Magic} \)

Calculate Remaining Lives in (\text{Touhou: Oriental Red Magic}

)

The game "Oriental Red Magic" has six stages, namely \(\text{Stage 1}\) to \(\text{Stage 6}\). The protagonist starts with 2 lives. In addition, the following bonuses are awarded:

  • When the score reaches (i.e., is greater than or equal to) \(10^7\), \(2 \times 10^7\), \(4 \times 10^7\), and \(6 \times 10^7\) points, the protagonist receives one extra life for each milestone reached.
  • Upon clearing \(\text{Stage 3}\) and \(\text{Stage 5}\), an additional life is rewarded.

You are given that the protagonist has just cleared \(\text{Stage }x\) and currently has a score \(s\). Determine the total number of lives the protagonist now has.

inputFormat

The input consists of two integers separated by a space: \(x\) and \(s\) where \(x\) is the stage number that was just cleared (ranging from 1 to 6) and \(s\) is the current score.

outputFormat

Output a single integer representing the total number of lives the protagonist currently has.

sample

3 15000000
4