{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\n \u0026nbsp; \u0026nbsp; \u0026nbsp; The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each stop.\n \u003cbr\u003e \n \u003cbr\u003e \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;For a given request list, you are to compute the total time spent to fulfill the requests on the list. The elevator is on the \n \u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e0th\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e floor at the beginning and does not have to return to the ground floor when the requests are fulfilled.\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv\u003e\n \u0026nbsp; \u0026nbsp; \u0026nbsp; There are multiple test cases. Each case contains a positive integer N, followed by N positive numbers. All the numbers in the input are less than 100. A test case with N \u003d 0 denotes the end of input. This test case is not to be processed.\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv\u003e\n Print the total time on a single line for each test case.\n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cdiv\u003e\n 1 2\n\u003c/div\u003e \n\u003cdiv\u003e\n 3 2 3 1\n\u003c/div\u003e \n\u003cdiv\u003e\n 0\n\u003c/div\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cdiv\u003e\n 17\n\u003c/div\u003e \n\u003cdiv\u003e\n 41\n\u003c/div\u003e"}}]}