{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"John is going on a fishing trip. He has **h** hours available, and there are **n** lakes in the area all reachable along a single, one-way road. John starts at lake **1**, but he can finish at any lake he wants. He can only travel from one lake to the next one, but he does not have to stop at any lake unless he wishes to. For each **i (1 to n-1)**, the number of **5**-minute intervals it takes to travel from lake **i** to lake **i+1** is denoted **t\u003csub\u003ei\u003c/sub\u003e**. For example, **t\u003csub\u003e3\u003c/sub\u003e\u003d4** means that it takes **20** minutes to travel from lake **3** to **4**.\n\nTo help plan his fishing trip, John has gathered some information about the lakes. For each lake **i**, the number of fish expected to be caught in the initial **5** minutes, denoted **f\u003csub\u003ei\u003c/sub\u003e**, is known. Each **5** minutes of fishing decreases the number of fish expected to be caught in the next **5**-minute interval by a constant rate of **d\u003csub\u003ei\u003c/sub\u003e**. If the number of fish expected to be caught in an interval is less than or equal to **d\u003csub\u003ei\u003c/sub\u003e**, there will be no more fish left in the lake in the next interval. To simplify the planning, John assumes that no one else will be fishing at the lakes to affect the number of fish he expects to catch. Write a program to help John plan his fishing trip to maximize the number of fish expected to be caught. The number of minutes spent at each lake must be a multiple of **5**.\n"}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026le; 100)**, denoting the number of test cases.\n\nEach case starts with a line containing two integers **n (2 \u0026le; n \u0026le; 25)** and **h (1 \u0026le; h \u0026le; 16)**. Next, there is a line of **n** integers specifying **f\u003csub\u003ei\u003c/sub\u003e (0 \u0026le; f\u003csub\u003ei\u003c/sub\u003e \u0026le; 1000)**, then a line of **n** integers **d\u003csub\u003ei\u003c/sub\u003e (0 \u0026le; d\u003csub\u003ei\u003c/sub\u003e \u0026le;1000)**, and finally, a line of **n-1** integers denoting **t\u003csub\u003ei\u003c/sub\u003e (0 \u0026lt; t\u003csub\u003ei\u003c/sub\u003e \u0026lt; 192)**.\n"}},{"title":"Output","value":{"format":"MD","content":"For each test case, print the case number first. Then print the number of minutes spent at each lake, separated by commas, for the plan achieving the maximum number of fish expected to be caught. This is followed by a line containing the number of fish expected. If multiple plans exist, choose the one that spends as long as possible at lake **1**. If there is still a tie, choose the one that spends as long as possible at lake **2**, and so on.\n"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n2 1\n10 1\n2 5\n2\n4 4\n10 15 20 17\n0 3 4 3\n1 2 3\n4 4\n10 15 50 30\n0 3 4 3\n1 2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1:\n45, 5\nNumber of fish expected: 31\nCase 2:\n240, 0, 0, 0\nNumber of fish expected: 480\nCase 3:\n115, 10, 50, 35\nNumber of fish expected: 724\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}