{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThe Government of Mars is not only interested in optimizing space flights, but also wants to improve the road system of the planet.\u003c/p\u003e\u003cp\u003eOne of the most important highways of Mars connects Olymp City and Kstolop, the capital of Cydonia. In this problem, we only consider the way from Kstolop to Olymp City, but not the reverse path (i.\u0026nbsp;e. the path from Olymp City to Kstolop).\u003c/p\u003e\u003cp\u003eThe road from Kstolop to Olymp City is $$$\\ell$$$ kilometers long. Each point of the road has a coordinate $$$x$$$ ($$$0 \\le x \\le \\ell$$$), which is equal to the distance from Kstolop in kilometers. So, Kstolop is located in the point with coordinate $$$0$$$, and Olymp City is located in the point with coordinate $$$\\ell$$$.\u003c/p\u003e\u003cp\u003eThere are $$$n$$$ signs along the road, $$$i$$$-th of which sets a speed limit $$$a_i$$$. This limit means that the next kilometer must be passed in $$$a_i$$$ minutes and is active until you encounter the next along the road. There is a road sign at the start of the road (i.\u0026nbsp;e. in the point with coordinate $$$0$$$), which sets the initial speed limit.\u003c/p\u003e\u003cp\u003eIf you know the location of all the signs, it\u0027s not hard to calculate how much time it takes to drive from Kstolop to Olymp City. Consider an example:\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/ea1f9c096794e139328bb0162cd91966?v\u003d1726294147\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\" width\u003d\"756px\"\u003e \u003c/center\u003e\u003cp\u003eHere, you need to drive the first three kilometers in five minutes each, then one kilometer in eight minutes, then four kilometers in three minutes each, and finally the last two kilometers must be passed in six minutes each. Total time is $$$3\\cdot 5 + 1\\cdot 8 + 4\\cdot 3 + 2\\cdot 6 \u003d 47$$$ minutes.\u003c/p\u003e\u003cp\u003eTo optimize the road traffic, the Government of Mars decided to remove no more than $$$k$$$ road signs. It cannot remove the sign at the start of the road, otherwise, there will be no limit at the start. By removing these signs, the Government also wants to make the time needed to drive from Kstolop to Olymp City as small as possible.\u003c/p\u003e\u003cp\u003eThe largest industrial enterprises are located in Cydonia, so it\u0027s the priority task to optimize the road traffic from Olymp City. So, the Government of Mars wants you to remove the signs in the way described above.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains three integers $$$n$$$, $$$\\ell$$$, $$$k$$$ ($$$1 \\le n \\le 500$$$, $$$1 \\le \\ell \\le 10^5$$$, $$$0 \\le k \\le n-1$$$), the amount of signs on the road, the distance between the cities and the maximal number of signs you may remove.\u003c/p\u003e\u003cp\u003eThe second line contains $$$n$$$ integers $$$d_i$$$ ($$$d_1 \u003d 0$$$, $$$d_i \u0026lt; d_{i+1}$$$, $$$0 \\le d_i \\le \\ell - 1$$$) — coordinates of all signs.\u003c/p\u003e\u003cp\u003eThe third line contains $$$n$$$ integers $$$a_i$$$ ($$$1 \\le a_i \\le 10^4$$$) — speed limits.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint a single integer — minimal possible time to drive from Kstolop to Olymp City in minutes, if you remove no more than $$$k$$$ road signs.\u003c/p\u003e"}},{"title":"Examples","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\u003e4 10 0\n0 3 4 8\n5 8 3 6\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e47\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e4 10 2\n0 3 4 8\n5 8 3 6\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e38\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first example, you cannot remove the signs. So the answer is $$$47$$$, as it\u0027s said in the statements above.\u003c/p\u003e\u003cp\u003eIn the second example, you may remove the second and the fourth sign. In this case, you need to drive four kilometers in $$$4\\cdot5 \u003d 20$$$ minutes, and then six kilometers in $$$6\\cdot3 \u003d 18$$$, so the total time is $$$4\\cdot5 + 6\\cdot3 \u003d 38$$$ minutes.\u003c/p\u003e"}}]}