{"trustable":false,"sections":[{"title":"","value":{"format":"PLAIN","content":"Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.\n\nThe shores of Rellau Creek in central Loowaterhad always been a prime breeding ground for geese.Due to the lack of predators,the geese population was out of control. The people ofLoowater mostly kept clear of the geese. Occasionally,a goose would attack one of the people, and perhaps bite off a finger or two, but in general, the people tolerated the geese as a minor nui-sance.\n\nOne day, a freak mutation occurred, and one of the geese spawned a multi-headed fire-breathing dragon. When the dragon grew up, he threatened to burn the Kingdom of Loowater to a crisp.Loowater had a major problem. The king was alarmed, and called on his knights to slay the dragon and save the kingdom.\n\nThe knights explained: \\To slay the dragon, we must chop off all its heads. Each knight can chop off one of the dragon\u0027s heads. The heads of the dragon are of different sizes. In order to chop off ahead, a knight must be at least as tall as the diameter of the head. The knights\u0027 union demands that for chopping off a head, a knight must be paid a wage equal to one gold coin for each centimetre of the knight\u0027s height.\"Would there be enough knights to defeat the dragon? The king called on his advisors to help him decide how many and which knights to hire. After having lost a lot of money building Mir Park, the king wanted to minimize the expense of slaying the dragon. As one of the advisors, your job was to help the king. You took it very seriously: if you failed, you and the whole kingdom would be burnt to a crisp!\n\n很久以前,在卢瓦特王国,一个小麻烦变成了大问题。\n\n卢瓦特中部的瑞洛溪沿岸一直是鹅的主要繁殖地,由于缺乏捕食者,鹅的数量失去了控制。 卢瓦特的人们大多远离鹅群。 偶尔,一只鹅会攻击一个人,也许会咬掉一两个手指,但总的来说,人们对鹅的容忍度不高。\n\n有一天,发生了一次怪异的变异,其中一只鹅产下了一条多头喷火龙。 当龙长大后,他威胁要把洛水王国烧成灰烬,洛水王国出了大问题。国王惊恐万分,号召他的骑士们杀死龙,拯救王国。\n\n骑士们解释道: \\要想杀死巨龙,我们必须砍下它所有的头颅 每个骑士可以砍掉龙的一个头。龙的头颅大小不一。要砍掉前面的龙头,骑士的身高至少要和龙头的直径一样高。骑士工会要求,砍掉一个头颅,骑士的身高每增加一厘米,必须得到相当于一个金币的工资。\"有足够的骑士来打败龙吗?国王召集他的顾问们帮他决定雇佣多少和哪些骑士。在建造米尔公园损失惨重之后,国王想把杀死龙的费用降到最低。作为顾问之一,你的工作就是帮助国王。你非常认真地对待它:如果你失败了,你和整个王国都会被烧成焦炭。"}},{"title":"输入","value":{"format":"PLAIN","content":"\nThe input contains several test cases. The first line of each test case contains two integers between 1 and 20000 inclusive, indicating the number n of heads that the dragon has, and the number m of knights in the kingdom. The next n lines each contain an integer, and give the diameters of the dragon\u0027s heads,in centimetres. The following m lines each contain an integer, and specify the heights of the knights of Loowater, also in centimetres.\n\nThe last test case is followed by a line containing `0 0\u0027.\n\n输入的内容包含几个测试用例。每个测试用例的第一行包含两个1到20000之间的整数,表示龙的头数n,以及王国中骑士的数量m。接下来的n行中,每行都包含一个整数,并给出龙头的直径,单位是厘米。接下来的m行中,每行都包含一个整数,并指定卢瓦特骑士的高度,也是以厘米为单位。\n\n最后一个测试案例后面是包含 \"0 0 \"的行。"}},{"title":"輸出","value":{"format":"PLAIN","content":"For each test case, output a line containing the minimum number of gold coins that the king needs topay to slay the dragon. If it is not possible for the knights of Loowater to slay the dragon, output the line `Loowater is doomed!\u0027.\n\n对于每个测试案例,输出一行包含国王击杀巨龙所需的最低金币数。如果卢瓦特的骑士们不可能杀死龙,则输出一行 \"卢瓦特注定要失败!\"。"}},{"title":"输入示例","value":{"format":"PLAIN","content":"2 3\n5\n4\n7\n8\n4\n2 1\n5\n5\n10\n0 0"}},{"title":"Sample Output","value":{"format":"PLAIN","content":"11\nLoowater is doomed!"}}]}