{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eThere are \u003cvar\u003e\\(N\\)\u003c/var\u003e towns on a line running east-west.\r\nThe towns are numbered \u003cvar\u003e\\(1\\)\u003c/var\u003e through \u003cvar\u003e\\(N\\)\u003c/var\u003e, in order from west to east.\r\nEach point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value.\r\nThe coordinate of town \u003cvar\u003e\\(i\\)\u003c/var\u003e is \u003cvar\u003e\\(X_i\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eYou are now at town \u003cvar\u003e\\(1\\)\u003c/var\u003e, and you want to visit all the other towns.\r\nYou have two ways to travel:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\r\n\u003cp\u003eWalk on the line.\r\nYour \u003cem\u003efatigue level\u003c/em\u003e increases by \u003cvar\u003e\\(A\\)\u003c/var\u003e each time you travel a distance of \u003cvar\u003e\\(1\\)\u003c/var\u003e, regardless of direction.\u003c/p\u003e\r\n\u003c/li\u003e\r\n\u003cli\u003e\r\n\u003cp\u003eTeleport to any location of your choice.\r\nYour fatigue level increases by \u003cvar\u003e\\(B\\)\u003c/var\u003e, regardless of the distance covered.\u003c/p\u003e\r\n\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eFind the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eAll input values are integers.\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(2≤N≤10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1≤X_i≤10^9\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eFor all \u003cvar\u003e\\(i(1≤i≤N-1)\\)\u003c/var\u003e, \u003cvar\u003e\\(X_i\u0026lt;X_{i+1}\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1≤A≤10^9\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1≤B≤10^9\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eThe input is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(A\\)\u003c/var\u003e \u003cvar\u003e\\(B\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(X_1\\)\u003c/var\u003e \u003cvar\u003e\\(X_2\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(X_N\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the minimum possible total increase of your fatigue level when you visit all the towns.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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 2 5\r\n1 2 5 7\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e11\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eFrom town \u003cvar\u003e\\(1\\)\u003c/var\u003e, walk a distance of \u003cvar\u003e\\(1\\)\u003c/var\u003e to town \u003cvar\u003e\\(2\\)\u003c/var\u003e, then teleport to town \u003cvar\u003e\\(3\\)\u003c/var\u003e, then walk a distance of \u003cvar\u003e\\(2\\)\u003c/var\u003e to town \u003cvar\u003e\\(4\\)\u003c/var\u003e.\r\nThe total increase of your fatigue level in this case is \u003cvar\u003e\\(2×1+5+2×2\u003d11\\)\u003c/var\u003e, which is the minimum possible value.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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\u003e7 1 100\r\n40 43 45 105 108 115 124\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e84\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eFrom town \u003cvar\u003e\\(1\\)\u003c/var\u003e, walk all the way to town \u003cvar\u003e\\(7\\)\u003c/var\u003e.\r\nThe total increase of your fatigue level in this case is \u003cvar\u003e\\(84\\)\u003c/var\u003e, which is the minimum possible value.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","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\u003e7 1 2\r\n24 35 40 68 72 99 103\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e12\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eVisit all the towns in any order by teleporting six times.\r\nThe total increase of your fatigue level in this case is \u003cvar\u003e\\(12\\)\u003c/var\u003e, which is the minimum possible value.\u003c/p\u003e\u003c/section\u003e\r\n"}}]}