{"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":"MD","content":"The second academic building of Idaho University of Telecommunications (IUT) has two elevators. Sadly, one of them is always out of order. So the building effectively has only one elevator. Mr. Arshad is responsible for the maintenance of these elevators. To improve the service provided by the functioning elevator, he wants to find out the time required to fulfill the requests of the students, staff, and faculty members.\nThe elevator is currently on the ground floor (Level 0). Mr. Arshad is given a list containing **N** positive numbers, denoting at which floor the lift will stop, in the specified order. It takes 6 seconds for the elevator to move up one floor and 4 seconds to move down one floor. The elevator stays at each floor for 5 seconds.\nGiven a list of requests, help Mr. Arshad to find out the total time required to fulfill all the requests."}},{"title":"Input","value":{"format":"MD","content":"There will be multiple test cases.\nEach case consists of a single line starting with a positive integer, **N (≤ 10\u003csup\u003e2\u003c/sup\u003e)**, followed by **N** positive numbers **(≤ 10\u003csup\u003e2\u003c/sup\u003e)**.\nThe test case with **N \u003d 0** denotes the end of input."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the total time required to fulfill all the requests."}},{"title":"Sample Input","value":{"format":"MD","content":"```\n1 2\n3 2 3 1\n0\n```"}},{"title":"Sample Output","value":{"format":"MD","content":"```\n17\n41\n```"}}]}