## TCCC '24 Apr P1 - Taxes, taxes!

View as PDF

Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Thornhill Computer Club 2024 - April Contest - Problem 1

An odd country taxes customers in stores for buying certain amounts of items, in order to encourage bulk buying:

Number different of items Tax cost
1 only $2 2 or 3$1
4 or 5 $0.5 6 or more$0

Given the number of items purchased by a single customer and each of their prices, determine the final cost to buy the items.

#### Input Specification

The first line will contain an integer representing the number of different items that the customer will buy.

The next lines will consist of 2 space-separated integers, , the cost of the item, and , the amount of the item that the customer will buy.

#### Output Specification

On a single line, output the cost of the entire purchase.

#### Sample Input 1

2
5 8
8 1

#### Sample Output 1

49.0

#### Explanation for Sample Output 1

The customer wants to buy 8 $5 items, and they also want to buy 1$8 item. This adds up to $40 +$8 = $48. Additionally, the customer wants to buy a total 2 items, so the store will charge$1 on top, so the final cost is \$49.