# Happiness!

Prof. Kaykobad has given Nasa the duty of buying some food for the ACM contestents. Nasa decided to buy n different items. He then asked each of the m contestents how much of each item they want to eat. They could not give any logical answer, they only want as much as they wish! Nasa knows quite well that they would only waste their food if they get as much as they want. He was determined not to let that happen. So he tactfully found out from each of the contestents how much ‘happiness’ one gets from each piece of each item and what is the ‘total happiness’ over which one wastes food. It may be the case that someone gets ‘zero’ ‘happiness’ on some item(s). He decided that he would never let anyone have such amount of food that exceeds his ‘total happiness’. He planned that he would give someone even a fraction of a piece of item, but never give anyone more than he needed! He also decided that each would get exactly the same amount of each item so that no one can complain against him. After planning all these, he finally realized that he has an infinite amount of money and hence, he would spend as much money as he can. Input Input contains data collected by Nasa on several days. For each day, • The first line contains the integers n and m (3 ≤ n, m ≤ 20). • The next line contains n real numbers, the per unit price of each item. • Each of the next m lines contain data (n + 1 real numbers) of each contestents: first n are ‘happiness’ got from each item and the last one is the ‘total happiness’. Output For the data collected in each day print in a single line the maximum amount of money Nasa can spend in taka rounded up to nearest integer. You can assume that there will be no such input which may cause serious floating point errors. Sample Input 33 1 0.67 1.67 1 2 1 430 3 0 2 460 1 4 0 420 Sample Output Nasa can spend 1354 taka.