406464: GYM102416 B Efficient market

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Efficient markettime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

According to the efficient-market hypothesis you cannot systematicaly make money from stock market. While the validity of that is debatable, so it happened that you came into possesion of a leak of stock prices for the next $$$n$$$ days. There is $$$m$$$ companies and on the day $$$i$$$ you know that the stock of the company number $$$j$$$ is going to have value of $$$a_{i,j}$$$ pounds. We assume that you start with $$$d$$$ pounds on day $$$0$$$. What is the most money you can have after those $$$n$$$ days? Each day you can make as many transactions as you like and we assume that the value of stocks stays constant on each day.

Input

In the first row there are three numbers: $$$1\leq n \leq 50$$$, $$$1\leq m \leq 1000$$$ and $$$0.00\leq d \leq 10^6$$$. In the following $$$m$$$ rows there are descriptions of stock values of each company for each day $$$1.00\leq d_{i,j} \leq 10.00$$$.

Output

Print the maximal amount of money you can have by the end of the last day, up to two decimal places (we accept error of $$$0.01$$$). You can assume that the answer will be no bigger than $$$10^9$$$.

ExampleInput
4 2 10.00
1.02 1.00 1.00 1.00
4.37 4.81 5.32 6.06
Output
13.87

加入题单

算法标签: