#C6716. Calculate Discounted Price

    ID: 50507 Type: Default 1000ms 256MiB

Calculate Discounted Price

Calculate Discounted Price

You are given the original price of a product and information on whether the customer is special. Your task is to calculate the new price after applying one or two discounts based on the following rules:

  • If \( p > 500 \): multiply the price by 0.8, i.e., \( new\_price = p \times 0.8 \).
  • If \( 200 \le p \le 500 \): multiply the price by 0.9, i.e., \( new\_price = p \times 0.9 \).
  • If \( p < 200 \): multiply the price by 0.95, i.e., \( new\_price = p \times 0.95 \).

After the above discount, if the customer is special, an additional discount of 5% is applied. That is:

[ new_price = new_price \times 0.95 ]

Output the final discounted price for each test case.

inputFormat

The input begins with an integer \(T\) denoting the number of test cases. Each test case is described in a separate line containing two values:

  • A floating point number \(p\) representing the original price.
  • A boolean value (either True or False) indicating whether the customer is special.

Values are space-separated.

outputFormat

For each test case, print the final discounted price on a new line.

## sample
2
600 False
150 True
480.0

135.375

</p>