#B3720. Dining Discounts

    ID: 11379 Type: Default 1000ms 256MiB

Dining Discounts

Dining Discounts

Bessie and her family are dining out tonight. The restaurant offers only three dishes named A, B, and C. A discount promotion is ongoing in which if the dining experience is quoted as Y discount, it means that the final payment is \(\frac{Y}{10}\) times the total dish amount.

The discount rules are as follows:

  • If dish B is ordered but dish C is not, the discount is 8 discount (i.e. the final payment is \(\frac{8}{10}\) of the total).
  • If dish C is ordered but dish B is not, the discount is 7 discount (i.e. the final payment is \(\frac{7}{10}\) of the total).
  • If both dishes B and C are ordered, the discount is 6 discount (i.e. the final payment is \(\frac{6}{10}\) of the total).

This time, Bessie’s family orders exactly two dishes. Note that the two dishes may be the same. The total dish amount is given as \(x\) yuan. Given the names of the two dishes and \(x\), compute the final payment amount after applying the appropriate discount.

inputFormat

The input consists of a single line containing two characters (each of which is either A, B, or C) representing the names of the ordered dishes, followed by an integer (x) representing the total dish amount.

outputFormat

Output the final payment amount after applying the discount rules. The discount is determined as follows:

  1. If dish B is ordered without dish C, the multiplier is (0.8).
  2. If dish C is ordered without dish B, the multiplier is (0.7).
  3. If both dish B and dish C are ordered, the multiplier is (0.6).
  4. Otherwise, the multiplier is (1) (no discount). The final payment is (x) multiplied by the corresponding multiplier. Print the result formatted with one decimal place.

sample

A A 100
100.0