{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\u003ci\u003e\u003cbr\u003eDisney\u0027s FastPass is a virtual queuing system created by the Walt Disney Company. First introduced in 1999 (thugh the idea of a ride reservation system was first introduced in world fairs), Fast-Pass allows guests to avoid long lines at the attractions on which the system is installed, freeing them to enjoy other attractions during their wait. The service is available at no additional charge to all park guests.\u003cbr\u003e--- wikipedia\u003cbr\u003e\u003c/i\u003e\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/8f76595d88967e032f6f43852b5439bd?v\u003d1714266856\"\u003e\u003c/center\u003e \u003cbr\u003eDisneyland is a large theme park with plenties of entertainment facilities, also with a large number of tourists. Normally, you need to wait for a long time before geting the chance to enjoy any of the attractions. The FastPass is a system allowing you to pick up FastPass-tickets in some specific position, and use them at the corresponding facility to avoid long lines. With the help of the FastPass System, one can arrange his/her trip more efficiently.\u003cbr\u003eYou are given the map of the whole park, and there are some attractions that you are interested in. How to visit all the interested attractions within the shortest time? \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains an integer T(1\u0026lt;\u003dT\u0026lt;\u003d25), indicating the number of test cases.\u003cbr\u003eEach test case contains several lines.\u003cbr\u003eThe first line contains three integers N,M,K(1 \u0026lt;\u003d N \u0026lt;\u003d 50; 0 \u0026lt;\u003d M \u0026lt;\u003d N(N - 1)/2; 0 \u0026lt;\u003d K \u0026lt;\u003d 8), indicating the number of locations(starting with 1, and 1 is the only gate of the park where the trip must be started and ended), the number of roads and the number of interested attractions.\u003cbr\u003eThe following M lines each contains three integers A,B,D(1 \u0026lt;\u003d A,B \u0026lt;\u003d N; 0 \u0026lt;\u003d D \u0026lt;\u003d 10^4) which means it takes D minutes to travel between location A and location B.\u003cbr\u003eThe following K lines each contains several integers P\u003csub\u003ei\u003c/sub\u003e, T\u003csub\u003ei\u003c/sub\u003e, FT\u003csub\u003ei\u003c/sub\u003e,N\u003csub\u003ei\u003c/sub\u003e, F\u003csub\u003ei,1\u003c/sub\u003e, F\u003csub\u003ei,2\u003c/sub\u003e ... F\u003csub\u003ei,Ni-1\u003c/sub\u003e, F\u003csub\u003eiNi\u003c/sub\u003e ,(1 \u0026lt;\u003d P\u003csub\u003ei\u003c/sub\u003e,N\u003csub\u003ei\u003c/sub\u003e, F\u003csub\u003ei,j\u003c/sub\u003e \u0026lt;\u003dN, 0 \u0026lt;\u003d FT\u003csub\u003ei\u003c/sub\u003e \u0026lt;\u003d T\u003csub\u003ei\u003c/sub\u003e \u0026lt;\u003d 10^4), which means the ith interested araction is placed at location Pi and there are Ni locations F\u003csub\u003ei,1\u003c/sub\u003e; F\u003csub\u003ei,2\u003c/sub\u003e ... F\u003csub\u003ei\u003c/sub\u003e,N\u003csub\u003ei\u003c/sub\u003e where you can get the FastPass for the ith attraction. If you come to the ith attraction with its FastPass, you need to wait for only FTi minutes, otherwise you need to wait for Ti minutes.\u003cbr\u003eYou can assume that all the locations are connected and there is at most one road between any two locations.\u003cbr\u003eNote that there might be several attrractions at one location."}},{"title":"Output","value":{"format":"HTML","content":"For each test case in the input, print one line: \"Case #X: Y\", where X is the test case number (starting with 1) and Y is the minimum time of the trip."}},{"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\u003e2\r\n4 5 2\r\n1 2 8\r\n2 3 4\r\n3 4 19\r\n4 1 6\r\n2 4 7\r\n2 25 18 1 3\r\n4 12 6 1 3\r\n4 6 2\r\n1 2 5\r\n1 4 4\r\n3 1 1\r\n3 2 1\r\n3 4 1\r\n2 4 10\r\n2 8 3 1 4\r\n4 8 3 1 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 53\r\nCase #2: 14\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}