#t233. 计算邮资

计算邮资

Postage Calculation

Problem Description

Compute the postage based on the weight of the mail and whether the user chooses express delivery. The rules are:

  • For a weight of 10001000 grams or less (including 10001000 grams), the base fee is 88 yuan.
  • For the part exceeding 10001000 grams, an overweight fee of 44 yuan is charged per 500500 grams; any part less than 500500 grams is counted as a full 500500 grams.
  • If the user chooses express delivery, an extra 55 yuan is charged.

Input Format

The input gives one line containing a positive integer and one character, separated by a space, representing the weight (in grams) and whether express delivery is chosen. If the character is y, express delivery is chosen; if it is n, it is not.

Output Format

Output one line containing a single integer: the postage.

Sample Input

1200 y

Sample Output

17

Hint

  • The overweight part "any fraction under 500500 grams counts as 500500 grams" — that is rounding up. Think about how integer division expresses it (the same trick as the apple-worm problem).
  • The input is "integer, space, character", and the express flag is the character y.
  • Check against the sample: 1200 y → 17.