406012: GYM102218 E Environmental Contingency

Memory Limit:32 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Environmental Contingencytime limit per test1 secondmemory limit per test32 megabytesinputstandard inputoutputstandard output

Last month in Mexico City there were a lot of forest fires and air quality in the capital was terrible for human bodies.

Air quality is measured with the Air Quality Index, or AQI. The AQI works like a thermometer that runs from 0 to 500 degrees. However, instead of showing changes in the temperature, the AQI is a way of showing changes in the amount of pollution in the air.

As the AQI was very high, government recommended to people to avoid outdoor activities or they could be exposed to some diseases. As air quality worsened day by day, the government of the capital decided to suspend classes for a couple of days because the situation could be dangerous for children and teenagers.

Now, they are worried about missing a lot of classes such that children will be less prepared for the future. They have built an artificial intelligence that predicts the AQI for $$$N$$$ days and they need you to solve the following problem:

Given the AQI for the next $$$N$$$ days, the name of the beginning day and a number $$$X$$$ (representing the minimum number of AQI such that on that specific day classes will be suspended), print the number of days such that classes will be suspended.

Each day name will be represented by any of the following strings: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" and "Sunday" (without the double quotes).

Please note that there are no classes on weekends in Mexico City.

Input

The first line contains $$$N$$$, $$$dayName$$$ and $$$X$$$ $$$(1 \le N \le 10^6, 0 \le X \le 500)$$$ - representing the number of days, the first day's name and the minimum amount of AQI such that classes will be suspended.

Second line contains $$$N$$$ integers $$$a_i$$$ $$$(0 \le a_i \le 500)$$$ - The AQI for each of the $$$N$$$ days.

Output

Print the number of days such that classes will be suspended.

ExamplesInput
10 Wednesday 6
1 2 3 4 5 6 7 8 9 10
Output
5
Input
5 Saturday 223
90 372 191 282 223
Output
2
Input
5 Sunday 269
90 372 191 282 223
Output
2
Note

In the first test case the only days that are greater or equal than 6 are the last five elements. These days are also weekdays.

In the second test case three AQI days are greater or equal than 223, but the second day is Sunday and classes won't be suspended on this day because there are no classes on weekends in Mexico City.

加入题单

算法标签: