

TeamworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 625 Accepted Submission(s): 330 Problem Description Some locations in city A has been destroyed in the fierce battle. So the government decides to send some workers to repair these locations. There are m kinds of workers that were trained for different skills. Each location need some number of some kinds of workers and has a schedule that at what time can the repair begins, and the time cost of repair. Any job cannot begin until all the workers required arrived. For example, location 1 needs 2 workers of type 1 and 3 workers of type 2, and the beginning time and time cost is 100 minute and 90 minute correspondingly, then 5 workers that satisfy the requirement should arrive before 100 minute, start working at 100 minute and get the job done at 190 minute. Notice that two different types of workers cannot replace each other, so with 3 workers of type 1 and only 2 workers of type 2, this job cannot be done. Workers can go from one location to another after their jobs are done. You can take the Euclidean distance between locations as the time workers need to travel between them. Each worker should be sent from a depot initially at 0 minute. Now your task is to determine the minimum number of workers needed to be sent from depot so that all the jobs can be done. Input There are multiple test cases, the integer on the first line T (T<25) indicates the number of test cases. Each test case begins with two integers n (<=150), the number of location(including the depot) and m(<=5), the number of different skills. The next line gives two integers x_{0}, y_{0} indicates the coordinate of depot. Then follows n  1 lines begins with 4 integer numbers: x_{i}, y_{i}, b_{i}(b_{i}>0), p_{i}(p_{i}>0), (x_{i}, y_{i}) gives the coordinate of the ith location, bi gives the beginning time and pi gives the time cost. The rest of the line gives m nonnegative integers v_{1}, v_{2}, ..., v_{m}, of which the ith number indicates the the number of workers of type i needed (for all v_{i}, 0<=v_{i}<10, each location at least requires one worker). All integers are less than 1000000 (10^{6}). Output For each test cases output one line, the minimum workers to be sent. It is guaranteed that there's always a feasible solution that all the jobs can be done. Sample Input
Sample Output
Source  
