CF319C Kalila and Dimna in the Logging Industry

Description

Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut $ n $ trees with heights $ a_{1},a_{2},...,a_{n} $ . They bought a chain saw from a shop. Each time they use the chain saw on the tree number $ i $ , they can decrease the height of this tree by one unit. Each time that Kalila and Dimna use the chain saw, they need to recharge it. Cost of charging depends on the id of the trees which have been cut completely (a tree is cut completely if its height equal to 0). If the maximum id of a tree which has been cut completely is $ i $ (the tree that have height $ a_{i} $ in the beginning), then the cost of charging the chain saw would be $ b_{i} $ . If no tree is cut completely, Kalila and Dimna cannot charge the chain saw. The chainsaw is charged in the beginning. We know that for each $ i $ < $ j $ , $ a_{i}<a_{j} $ and $ b_{i}>b_{j} $ and also $ b_{n}=0 $ and $ a_{1}=1 $ . Kalila and Dimna want to cut all the trees completely, with minimum cost. They want you to help them! Will you?

Input Format

N/A

Output Format

N/A