In the city of Wonkville, inside the world-famous chocolate factory is a lottery system called the Upside-Down Chocolate Room. Here, delightful treats are hidden behind a series of magical upside-down slot machines. Contestants who may enter the room follow a curious tradition: instead of pulling levers downward, they prefer to pull them upwards!
As a contestant in the Chocolate Room, you are given a set of $$$k$$$ slot machines, each with an associated reward distribution. Each slot machine $$$i$$$ generates rewards according to a known finite, discrete probability distribution $$$P_i$$$. You have a total of $$$n$$$ pulls to distribute among the $$$k$$$ slot machines. Your task is to maximize your expected winnings after these $$$n$$$ pulls. After $$$n$$$ pulls, what is the value of your expected winnings?
The first line contains two integers $$$n$$$ and $$$k$$$ for $$$1 \leq n,k \leq 100$$$.
The following $$$3k$$$ lines contain three separate lines for each slot machine $$$1 \leq i \leq k$$$:
Please determine the maximum expected winnings from $$$k$$$ slot machines after $$$n$$$ pulls.
Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{−6}$$$.
5 351 3 9 7 30.15 0.4 0.1 0.2 0.1528 70.5 0.531 2 30.25 0.30 0.45
37.5