On 1 January 2002, the Netherlands and several other European countries abandoned their national currencies in favour of the euro. This changed how easy it is to pay, and not just internationally.
Before the switch, a student buying a 68-guilder book could pay with one 50-guilder note and two 10-guilder notes, receiving 2 guilders in change: 50 + 10 + 10 - 1 - 1 = 68. Other ways were 50 + 25 - 5 - 1 - 1 or 100 - 25 - 5 - 1 - 1. Either way at least 5 units (notes or coins) are involved, and it cannot be done with fewer.
Paying for a 68-euro book is easier these days: 50 + 20 - 2 = 68, so only 3 units are involved. This is no coincidence; for many amounts, paying with euros is more efficient than paying with guilders. It has nothing to do with the value of the euro, only with the chosen denominations. The guilder units were 1, 2.5, 5, 10, 25, 50, whereas the euro units are 1, 2, 5, 10, 20, 50.
For this problem we restrict ourselves to amounts up to 100 cents. The euro has coins of 1, 2, 5, 10, 20, and 50 cents. To pay an arbitrary amount from 1 to 100 cents, on average 2.96 coins are involved, either as payment or as change. The euro series is not optimal in this sense. With the coins 1, 24, 34, 39, 46, 50, an amount of 68 cents can be paid using two coins (34 + 34), and the average number of coins needed to pay an amount from 1 to 100 cents drops to 2.52.
Calculations with such a series are harder to do in your head, but they are easy to program on any mobile phone, which nearly everybody carries around nowadays. Preparing for the future, a committee is studying which series of coins is most efficient for amounts up to 100 cents, and needs your help.
Write a program that, given a series of coins, computes the average and the maximum number of coins needed to pay any amount from 1 to 100 cents. You may assume that both parties have an unlimited supply of every coin. Paying an amount means handing over some coins and receiving some coins as change; the number of coins involved is the total of both, and for each amount this total is minimized.
The first line of the input contains the number of test cases. Each test case is described on a single line by 6 distinct positive integers in ascending order: the values of the coins. The first value is always 1, and the last value is less than 100.
For each test case, output a single line containing the average and then the maximum number of coins involved in paying an amount from 1 to 100 cents, separated by a space. The average must always be printed with exactly two digits after the decimal point; the maximum is always an integer.