Calculated according to weight and whether the user choose express mail postage, computation rules: weight 1000 grams (including 1000 grams), basic 8 yuan, more than 1000 grams, every 500 grams overweight extra fee 4 yuan, less than 500 g part calculated at 500 grams; If the user selects the urgent, more than five yuan,
Enter
Input line contains an integer and one character at a time, separated by a space, respectively, said the weight (in grams) and is urgent, if the character is y, explaining the urgent; If the character is n that is not urgent,
O
Output a line contains an integer, said the postage,
The sample input
1200 y
Sample output
17