Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
Buying Books from Internet
You want to buy books from internet. The
companies offer different prices for the
books and for shipping. They also offer
different shipping price if you order more
than one copies.
Question:
Read the information for n orders
and calculate total price to pay.
Input specification
First you will be given
the number of orders (n) where n is between
0 and 5000. Then, in the following n lines
you will be given information for n orders.
Each order information contains four numbers
- The number of books: an integer between 1 and 10.
- Price of a book: a floating point
number between 1 and 25.
- Shipping price for one book: a floating
point number between 1 and 15
- Shipping price for multiple copies:
a floating point number between 1 and 10
Output specification
Show one floating point number with
two digits precision.
Sample Input
3
2 5.5 3 2
1 5.4 7.1 5.1
2 7.5 3.5 2
|
Sample Output
46.50
|
Explanation:
- The first book has been ordered 2 copies:
(5.5*2) + (2*2) = 15
- The second book has been ordered only one copy:
(5.4) + (7.1) = 12.5
- The third book has been ordered 2 copies:
(7.5*2) + (2*2) = 19
And the total is (15 + 12.5 + 19) 46.50
Для отправки решений необходимо выполнить вход.
|