{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"text-align: justify;\"\u003eIn a city there are\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e\u0026nbsp;bus drivers. Also there are\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e\u0026nbsp;morning bus routes \u0026amp;\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u0026nbsp;\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003eafternoon bus routes with various lengths. Each driver is assigned one morning route \u0026amp; one evening route. For any driver, if his total route length for a day exceeds\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003ed\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e, he has to be paid overtime for every hour after the first\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003ed\u0026nbsp;\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003ehours at a flat\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003er\u0026nbsp;\u003c/b\u003e\u003cspan data-scayt_word\u003d\"taka\" data-scaytid\u003d\"1\"\u003etaka\u003c/span\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e\u0026nbsp;/ hour. Your task is to assign one morning route \u0026amp; one evening route to each bus driver so that the total overtime amount that the authority has to pay is minimized.\u003c/span\u003e\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"text-align: justify;\"\u003eThe first line of each test case has three integers\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e,\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003ed\u0026nbsp;\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003eand\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003er\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e, as described above. In the second line, there are\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u0026nbsp;\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003espace separated integers which are the lengths of the morning routes given in meters. Similarly the third line has\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u0026nbsp;\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003espace separated integers denoting the evening route lengths. The lengths are positive integers less than or equal to 10000. The end of input is denoted by a case with three 0 s.\u003c/span\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cstrong\u003e- \u0026nbsp; 1 \u0026le; n \u0026le; 100\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cstrong\u003e- \u0026nbsp; 1 \u0026le; d \u0026le; 10000\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cstrong\u003e- \u0026nbsp; 1 \u0026le; r \u0026le; 5\u003c/strong\u003e\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"text-align: justify;\"\u003eFor each test case, print the minimum possible overtime amount that the authority must pay.\u003c/span\u003e\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n2 20 5\r\n10 15\r\n10 15\r\n2 20 5\r\n10 10\r\n10 10\r\n0 0 0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n50\r\n0\u003c/pre\u003e"}}]}