HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


50814 - Buying Books from Internet

Guest
• Review clarifications (1)

Volume problems

• 50952 - Derby Tirana
• 50871 - Harmonic Mean
• 50859 - Low performance
• 50508 - The Biggest Area
• 51077 - Grades Histogram
• 50528 - Rock-Scissors-Paper
• 50744 - The Smallest Perimeter
• 50808 - Total Distance Traveled
• 50814 - Buying Books from Inte...
• 50812 - Total Discount for the clients
• 50832 - Rock Paper Scissors Lizard ...
• 51046 - The biggest number
• 50867 - Average of the Best Grades
• Reflektimi i pikes
• 50994 - The Most Crowded Station
• 51194 - The difference between max...
• 002. 50554 - nth power of m

Feedback

If you notice incorrect translations in Contester, please let author know.

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

  1. The number of books: an integer between 1 and 10.
  2. Price of a book: a floating point number between 1 and 25.
  3. Shipping price for one book: a floating point number between 1 and 15
  4. 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



Для отправки решений необходимо выполнить вход.

www.contester.ru