DMOPC '15 Contest 7 P3 - Harbourmaster
View as PDF is playing a game. In this game, players send out ships to complete voyages for profit. Each voyage has numerical requirements in at least one of the Coding, Anti-seasickness, and Pathfinding attributes (its programmer crew must remain both mentally healthy by programming, and physically healthy by eating decent food, all while not getting lost). The closer a player's ship comes to fulfilling these requirements, the greater its chance of success. A ship can hold five crew members, and each member contributes some constant to their ship's attributes.  has  such crew members, which he may assign to any ship.
A voyage's chance of success is defined as the minimum ratio between a voyage attribute and the sum of all crew members in that attribute, and maxes out at . For example, if both the Anti-seasickness and Pathfinding requirements are met while the requirement for Coding is 
 but the crew only provides 
, the voyage's chance of success will be 
.
Since has to manage many ships at once, determining his maximum chance of success would go a long way towards increasing his status as a harbourmaster. Can you help him?
Input Specification
The first line of input will contain three integers  representing the voyage's Coding, Anti-seasickness, and Pathfinding requirements respectively 
.
The second line of input will contain  
.
For the next  lines, line 
 will represent the attributes of the 
-th crew member 
 in the same order as given for the voyage 
.
Output Specification
's maximum chance of success if he assigns his crew optimally, rounded to one decimal place.
Sample Input
10 10 100
2
0 5 0
9 0 2
Sample Output
2.0
Explanation
The crew got lost, because while the voyage had  Coding and 
 Anti-seasickness, their Pathfinding total was 
.
Comments
.