#D6067. Strange Plants
Strange Plants
Strange Plants
problem
A mysterious [cm] plant grows in one place. This plant has the following mysterious properties.
- Say "nobiro" to this plant and it will grow [cm].
- Say "tidime" to this plant and it will grow [cm].
- If you say "karero" to this plant, it will be [cm].
However, this plant does not have a negative length. Specifically, when it grows from the state of [cm] to [cm] , it is a plant. Stops growing when it reaches [cm].
Say one of "nobiro", "tidime", "karero" to this plant only once a day for days. Find the length [cm] of the plant after days.
output
Print the length of the plant after days. Also print a newline at the end.
Example
Input
10 30 10 3 nobiro nobiro tidime
Output
80
inputFormat
outputFormat
output
Print the length of the plant after days. Also print a newline at the end.
Example
Input
10 30 10 3 nobiro nobiro tidime
Output
80
样例
10 30 10
3
nobiro
nobiro
tidime
80