T-Shirts

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Recipe 1

Ahmed, the mighty leader of the anti-gang gang AC, is also the owner of a major franchise that sells clothing! As the 2nd in command of Calvin's gang CA (rival gang of AC), you come up with a sneaky idea to put them out of business: buying out their entire T-shirt stock and monopolizing the T-shirt industry! All that's left is to calculate how much money you need to ask your Boss for in order to execute your scheme. AC T-shirts come in 3 sizes — small, medium and large. You can purchase small T-shirts for A dollars, medium T-shirts for B dollars, and large T-shirts for C dollars. Of course, small shirts cost strictly less than medium shirts which cost strictly less than large shirts. In addition, AC also has a special buy — 3-T-shirts get one free deal. That is, for every 3 shirts you buy full priced, you can pick a T-shirt of any size and purchase it at $0. With this information in mind, you would like to figure out the minimum amount of money you need to buy out AC's T-shirts.

Input Specification

Line 1: Three integers space separated: S, M, L — number of small, medium and large T-shirts AC has in stock.

Line two: Prices, A, B, C space separated with each price in the format: D.C (dollars and cents, joined by a period). Each price is guaranteed to be between 0.01 and 99.99, and together satisfy A < B < C.

Output Specification

A single real number on one line, the amount of money asked in the problem statement, rounded to two decimal places in the format D.C (dollars and cents, joined by a period).

Note: neither input nor output should have leading zeroes, 5 dollars should be expressed as 5.00, not 05.00.

Constraints

0 \le S,M,L \le 10\,000

0.01 \le A < B < C \le 99.99

Sample Input

3 2 1
1.00 2.00 3.00

Sample output

7.00

Comments


  • 1
    FatalEagle  commented on April 2, 2015, 5:34 p.m.

    Sorry to those people trying to solve this problem with exact precision, numbers did not necessarily have 2 points after the decimal.

    This has been fixed and all submissions rejudged.