#P104. 练18.4 计算邮资

练18.4 计算邮资

Description

Calculate the postage based on the weight of the mail and whether the user chooses express delivery. Calculation rules: For weights up to 10001000 grams (inclusive), the base fee is 88 yuan. For the portion exceeding 10001000 grams, an additional fee of 44 yuan is charged for every 500500 grams, with any portion less than 500500 grams being counted as 500500 grams. If the user chooses express delivery, an additional 55 yuan is charged.

Input Format

Input consists of a single line containing an integer and a character, separated by a space, representing the weight (in grams) and whether express delivery is chosen. If the character is yy, it means express delivery is chosen; if the character is nn, it means express delivery is not chosen.

Output Format

Output a single line containing an integer, representing the postage.

Sample

1200 y
17