{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\nWhen we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery.\n\u003c/p\u003e\n\n\u003cp\u003e\nSuppose there are \u003ci\u003eN\u003c/i\u003e people living in a straight street that is just lies on an X-coordinate axis. The \u003ci\u003ei\u003c/i\u003e\u003csup\u003eth\u003c/sup\u003e person\u0027s coordinate is \u003ci\u003eX\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e meters. And in the street there is a take-out restaurant which has coordinates \u003ci\u003eX\u003c/i\u003e meters. One day at lunchtime, each person takes an order from the restaurant at the same time. As a worker in the restaurant, you need to start from the restaurant, send food to the \u003ci\u003eN\u003c/i\u003e people, and then come back to the restaurant. Your speed is \u003ci\u003eV\u003csup\u003e-1\u003c/sup\u003e\u003c/i\u003e meters per minute.\n\u003c/p\u003e\n\n\u003cp\u003e\nYou know that the \u003ci\u003eN\u003c/i\u003e people have different personal characters; therefore they have different feeling on the time their food arrives. Their feelings are measured by \u003cem\u003e\u003cstrong\u003eDispleasure Index\u003c/strong\u003e\u003c/em\u003e. At the beginning, the \u003cem\u003e\u003cstrong\u003eDispleasure Index\u003c/strong\u003e\u003c/em\u003e for each person is 0. When waiting for the food, the \u003ci\u003ei\u003c/i\u003e\u003csup\u003eth\u003c/sup\u003e person will gain \u003ci\u003eB\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e \u003cem\u003e\u003cstrong\u003eDispleasure Index\u003c/strong\u003e\u003c/em\u003e per minute.\n\u003c/p\u003e\n\n\u003cp\u003e\nIf one\u0027s \u003cem\u003e\u003cstrong\u003eDispleasure Index\u003c/strong\u003e\u003c/em\u003e goes too high, he will not buy your food any more. So you need to keep the sum of all people\u0027s \u003cem\u003e\u003cstrong\u003eDispleasure Index\u003c/strong\u003e\u003c/em\u003e as low as possible in order to maximize your income. Your task is to find the minimal sum of \u003cem\u003e\u003cstrong\u003eDispleasure Index\u003c/strong\u003e\u003c/em\u003e.\n\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003e\nThe input contains multiple test cases, separated with a blank line. Each case is started with three integers \u003ci\u003eN\u003c/i\u003e ( 1 \u0026lt;\u003d \u003ci\u003eN\u003c/i\u003e \u0026lt;\u003d 1000 ), \u003ci\u003eV\u003c/i\u003e ( \u003ci\u003eV\u003c/i\u003e \u0026gt; 0), \u003ci\u003eX\u003c/i\u003e ( \u003ci\u003eX\u003c/i\u003e \u0026gt;\u003d 0 ), then \u003ci\u003eN\u003c/i\u003e lines followed. Each line contains two integers \u003ci\u003eX\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ( \u003ci\u003eX\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e \u0026gt;\u003d 0 ), \u003ci\u003eB\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ( \u003ci\u003eB\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e \u0026gt;\u003d 0), which are described above.\n\u003c/p\u003e\n\n\u003cp\u003e\nYou can safely assume that all numbers in the input and output will be less than 2\u003csup\u003e31\u003c/sup\u003e - 1.\n\u003c/p\u003e\n\n\u003cp\u003e\nPlease process to the end-of-file.\n\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003e\nFor each test case please output a single number, which is the minimal sum of \u003cem\u003e\u003cstrong\u003eDispleasure Index\u003c/strong\u003e\u003c/em\u003e. One test case per line.\n\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eSample Input\u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003e\n5 1 0\u003cbr\u003e\n1 1\u003cbr\u003e\n2 2\u003cbr\u003e\n3 3\u003cbr\u003e\n4 4\u003cbr\u003e\n5 5\u003cbr\u003e\n\u003cbr\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eSample Output\u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003e\n55\u003cbr\u003e\n\u003cbr\u003e\n\u003c/p\u003e\n\n"}}]}