{"raw_statement":[{"iden":"statement","content":"Arkady and Masha want to choose decorations for thier aquarium in Fishdom game. They have _n_ decorations to choose from, each of them has some cost. To complete a task Arkady and Masha need to choose **exactly** _m_ decorations from given, and they want to spend as little money as possible.\n\nThere is one difficulty: Masha likes some _a_ of the given decorations, Arkady likes some _b_ of the given decorations. Some decorations may be liked by both Arkady and Masha, or not be liked by both. The friends want to choose such decorations so that each of them likes **at least** _k_ decorations among the chosen. Help Masha and Arkady find the minimum sum of money they need to spend."},{"iden":"input","content":"The first line contains three integers _n_, _m_ and _k_ (1 ≤ _n_ ≤ 200000, 1 ≤ _m_ ≤ _n_, 1 ≤ _k_ ≤ _n_) — the number of decorations, how many decorations the friends should choose, how many decorations each of them should like among the chosen.\n\nThe second line contains _n_ integers _c_1, _c_2, ..., _c__n_ (1 ≤ _c__i_ ≤ 109) — decorations costs.\n\nThe third line contains single integer _a_ (1 ≤ _a_ ≤ _n_) — the number of decorations liked by Masha. The fourth line contains _a_ distinct integers _x_1, _x_2, ..., _x__a_ (1 ≤ _x__i_ ≤ _n_) — the ids of decorations liked by Masha.\n\nThe next two lines describe decorations liked by Arkady in the same format."},{"iden":"output","content":"Print single integer: the minimum sum of money the friends should spend to fulfill all constraints. If it is not possible, print _\\-1_."},{"iden":"examples","content":"Input\n\n4 3 2\n3 2 2 1\n2\n1 2\n2\n1 3\n\nOutput\n\n7\n\nInput\n\n4 3 2\n3 2 2 1\n2\n1 2\n3\n4 1 3\n\nOutput\n\n6\n\nInput\n\n4 2 2\n3 2 2 1\n2\n1 2\n3\n4 1 3\n\nOutput\n\n\\-1"},{"iden":"note","content":"In the first example the only possible variant to choose 3 decorations having all conditions satisfied is to choose decorations 1, 2, 3.\n\nIn the second example friends can choose decoration 4 instead of decoration 3, because this one is one coin cheaper.\n\nIn the third example it's not possible to choose 2 decorations in a way that both are liked by both Masha and Arkady."}],"translated_statement":[{"iden":"statement","content":"Arkady 和 Masha 想要在 Fishdom 游戏中为他们的水族箱选择装饰品。他们有 #cf_span[n] 个装饰品可供选择，每个装饰品都有一定的价格。为了完成任务，Arkady 和 Masha 需要从给定的装饰品中 *恰好* 选择 #cf_span[m] 个，并且他们希望花费尽可能少的钱。\n\n有一个难点：Masha 喜欢其中的 #cf_span[a] 个装饰品，Arkady 喜欢其中的 #cf_span[b] 个装饰品。某些装饰品可能被两人同时喜欢，也可能两人都不喜欢。朋友们希望选择这样的装饰品，使得每个人至少喜欢所选装饰品中的 #cf_span[k] 个。请帮助 Masha 和 Arkady 找到他们需要花费的最少金额。\n\n第一行包含三个整数 #cf_span[n], #cf_span[m] 和 #cf_span[k] (#cf_span[1 ≤ n ≤ 200000], #cf_span[1 ≤ m ≤ n], #cf_span[1 ≤ k ≤ n]) —— 装饰品的数量、朋友应选择的装饰品数量、每个人在所选装饰品中至少喜欢的数量。\n\n第二行包含 #cf_span[n] 个整数 #cf_span[c1, c2, ..., cn] (#cf_span[1 ≤ ci ≤ 109]) —— 装饰品的价格。\n\n第三行包含一个整数 #cf_span[a] (#cf_span[1 ≤ a ≤ n]) —— Masha 喜欢的装饰品数量。第四行包含 #cf_span[a] 个互不相同的整数 #cf_span[x1, x2, ..., xa] (#cf_span[1 ≤ xi ≤ n]) —— Masha 喜欢的装饰品编号。\n\n接下来两行以相同格式描述 Arkady 喜欢的装饰品。\n\n请输出一个整数：朋友为满足所有约束条件所需花费的最少金额。如果不可能满足条件，请输出 _-1_。\n\n在第一个例子中，满足所有条件的唯一可能选择是选择装饰品 #cf_span[1], #cf_span[2], #cf_span[3]。\n\n在第二个例子中，朋友可以选择装饰品 #cf_span[4] 代替 #cf_span[3]，因为这个更便宜一金币。\n\n在第三个例子中，不可能选择 #cf_span[2] 个装饰品使得两者都被 Masha 和 Arkady 同时喜欢。"},{"iden":"input","content":"第一行包含三个整数 #cf_span[n], #cf_span[m] 和 #cf_span[k] (#cf_span[1 ≤ n ≤ 200000], #cf_span[1 ≤ m ≤ n], #cf_span[1 ≤ k ≤ n]) —— 装饰品的数量、朋友应选择的装饰品数量、每个人在所选装饰品中至少喜欢的数量。第二行包含 #cf_span[n] 个整数 #cf_span[c1, c2, ..., cn] (#cf_span[1 ≤ ci ≤ 109]) —— 装饰品的价格。第三行包含一个整数 #cf_span[a] (#cf_span[1 ≤ a ≤ n]) —— Masha 喜欢的装饰品数量。第四行包含 #cf_span[a] 个互不相同的整数 #cf_span[x1, x2, ..., xa] (#cf_span[1 ≤ xi ≤ n]) —— Masha 喜欢的装饰品编号。接下来两行以相同格式描述 Arkady 喜欢的装饰品。"},{"iden":"output","content":"请输出一个整数：朋友为满足所有约束条件所需花费的最少金额。如果不可能满足条件，请输出 _-1_。"},{"iden":"examples","content":"输入\n4 3 2\n3 2 2 1\n2\n1 2\n2\n1 3\n输出\n7\n\n输入\n4 3 2\n3 2 2 1\n2\n1 2\n3\n4 1 3\n输出\n6\n\n输入\n4 2 2\n3 2 2 1\n2\n1 2\n3\n4 1 3\n输出\n-1"},{"iden":"note","content":"在第一个例子中，满足所有条件的唯一可能选择是选择装饰品 #cf_span[1], #cf_span[2], #cf_span[3]。在第二个例子中，朋友可以选择装饰品 #cf_span[4] 代替 #cf_span[3]，因为这个更便宜一金币。在第三个例子中，不可能选择 #cf_span[2] 个装饰品使得两者都被 Masha 和 Arkady 同时喜欢。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, m, k \\in \\mathbb{Z}^+ $ denote the total number of decorations, the number to choose, and the minimum number of liked decorations each person must have.  \nLet $ C = (c_1, c_2, \\dots, c_n) \\in \\mathbb{Z}^n $ be the cost vector of decorations.  \nLet $ M \\subseteq \\{1, \\dots, n\\} $ be the set of decorations liked by Masha, with $ |M| = a $.  \nLet $ A \\subseteq \\{1, \\dots, n\\} $ be the set of decorations liked by Arkady, with $ |A| = b $.  \n\nDefine the four disjoint subsets based on preference:  \n- $ M \\cap A $: liked by both  \n- $ M \\setminus A $: liked only by Masha  \n- $ A \\setminus M $: liked only by Arkady  \n- $ (M \\cup A)^c $: liked by neither  \n\nLet:  \n- $ p = |M \\cap A| $  \n- $ q = |M \\setminus A| $  \n- $ r = |A \\setminus M| $  \n- $ s = n - p - q - r $  \n\n**Constraints**  \n1. $ 1 \\leq n \\leq 200000 $, $ 1 \\leq m \\leq n $, $ 1 \\leq k \\leq n $  \n2. $ 1 \\leq c_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $  \n3. $ 1 \\leq a, b \\leq n $  \n4. All decoration IDs in M and A are distinct and in $ \\{1, \\dots, n\\} $  \n5. The chosen set $ S \\subseteq \\{1, \\dots, n\\} $, $ |S| = m $, must satisfy:  \n   - $ |S \\cap M| \\geq k $  \n   - $ |S \\cap A| \\geq k $  \n\n**Objective**  \nMinimize $ \\sum_{i \\in S} c_i $, subject to the above constraints.  \nIf no such $ S $ exists, output $ -1 $.","simple_statement":null,"has_page_source":false}