{"trustable":false,"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":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n Mr.Panda is about to engage in his favourite activity doing laundry! He’s brought L indistinguishable loads of laundry to his local laundromat, which has N washing machines and M dryers.The $i^{th}$ washing machine takes $W_i$ minutes to wash one load of laundry, and the $i^{th}$ dryer takes Di minutes to dry a load of laundry. \n \u003cbr\u003eAt any point in time, each machine may only be processing at most one load of laundry. \n \u003cbr\u003eAs one might expect, Panda wants to wash and then dry each of his L loads of laundry. Each load of laundry will go through the following steps in order: \n \u003cbr\u003e1. A non-negative amount of time after Panda arrives at the laundromat, Panda places the load in an unoccupied washing machine i. \n \u003cbr\u003e2. Wi minutes later, he removes the load from the washing machine, placing it in a temporary holding basket (which has unlimited space) \n \u003cbr\u003e3. A non-negative amount of time later, he places the load in an unoccupied dryer j \n \u003cbr\u003e4. Dj minutes later, he removes the load from the dryer Panda can instantaneously add laundry to or remove laundry from a machine. Help Panda minimize the amount of time (in minutes after he arrives at the laundromat) after which he can be done washing and drying all L loads of laundry! \n \u003cbr\u003e \n\u003c/div\u003e\n有L件衣服,有N个洗衣机,有M个烘干机,给出每个洗衣机洗一件衣服的时间和烘干机烘干一件衣服的时间,每件衣服需要先洗再烘干,问如何给每件衣服安排洗衣机和烘干机,使得花费的总时间最少?"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input gives the number of test cases, T. \n\u003cbr\u003eT test cases follow. Each test case consists of three lines. The first line contains three integer L, N, and M. \n\u003cbr\u003eThe second line contains N integers $W_1, W_2, ... , W_N$ representing the wash time of each wash machine. \n\u003cbr\u003eThe third line contains M integers $D_1, D_2, ..., D_M$ representing the dry time of each dryer. \n\u003cbr\u003e\n第一行包含一个整数T,表示测试数据的组数。\u003cbr\u003e\n对于每组测试数据,第一行三个整数L,N,M\u003cbr\u003e\n第二行N个整数,表示每台洗衣机洗衣服的时间,W_1,W_2,...,W_N\u003cbr\u003e\n第三行N个整数,表示每台烘干机烘干衣服的时间,D_1,D_2,...,D_N\u003cbr\u003e\n\n"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output one line containing “Case #x: y”, where x is the test case number (starting from 1) and y is the minimum time it will take Panda to finish his laundry. \n\u003cbr\u003e \n\u003ch2\u003elimits\u003c/h2\u003e \n\u003cbr\u003e$\\bullet 1 ≤ T ≤ 100$. \n\u003cbr\u003e$\\bullet 1 ≤ L ≤ 10^6$. \n\u003cbr\u003e$\\bullet 1 ≤ N, M ≤ 10^5$. \n\u003cbr\u003e$\\bullet 1 ≤ W_i, D_i ≤ 10^9$.\n\u003cbr\u003e对于每组输出,输出\"Case #x:y\",x表示测试数据的编号,y表示最少完成的时间。"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\n1 1 1\n1200\n34\n2 3 2\n100 10 1\n10 10\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase #1: 1234\nCase #2: 12\u003c/pre\u003e"}}]}