#K76817. Customer Discount Calculator

    ID: 34727 Type: Default 1000ms 256MiB

Customer Discount Calculator

Customer Discount Calculator

In this problem, you are required to compute the total discount given to a customer based on their loyalty and spending history. The discount is computed as follows:

If the number of months the customer has been purchasing, denoted by months, is greater than 6, the customer receives a fixed discount of fixed_discount.

If the total amount spent in the past year, denoted by yearly_spent, is greater than 1000, the customer receives an additional discount of extra_discount.

The total discount is the sum of these two potential discounts. In mathematical form:

\(\text{total_discount} = \begin{cases} \text{fixed_discount} & \text{if } months > 6 \end{cases} + \begin{cases} \text{extra_discount} & \text{if } yearly_spent > 1000 \end{cases}\)

Your task is to implement a solution that reads the input from standard input (stdin) and prints the result to standard output (stdout).

inputFormat

The input consists of a single line with four values separated by spaces:

  • months (integer): The number of months the customer has been purchasing.
  • yearly_spent (float): The total amount spent by the customer in the past year.
  • fixed_discount (integer): The fixed discount percentage for loyal customers.
  • extra_discount (integer): The additional discount percentage for high spending customers.

outputFormat

Output a single integer representing the total discount the customer will receive.

## sample
7 1200.50 20 10
30