#K3096. Delivery Charges Calculation
Delivery Charges Calculation
Delivery Charges Calculation
You are given the number of kilometers traveled for deliveries in a month for several test cases. For each test case, if the distance D is less than or equal to 500 kilometers, the delivery charge is computed at $5$ per kilometer. If the distance exceeds 500 kilometers, the first 500 kilometers are charged at $5$ per kilometer and the remaining kilometers at $4$ per kilometer.
Your task is to calculate the total delivery charge for each test case and print each result on a separate line.
The formula to compute the total charge is:
\[ \text{total t charge} = \begin{cases} D \times 5, & \text{if } D \leq 500 \\ 500 \times 5 + (D - 500) \times 4, & \text{if } D > 500 \end{cases} \]
inputFormat
The input is provided via standard input (stdin) and has the following format:
- The first line contains a single integer T denoting the number of test cases.
- This is followed by T lines, where each line contains a single integer representing the distance traveled for that test case.
outputFormat
For each test case, output the total delivery charge on a new line to standard output (stdout).
## sample1
450
2250
</p>