{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOld Bilbo collects songs and sagas of all races of Middle-earth. Every twenty \r\nyears he leaves Rivendell for a year to travel through \u003ci\u003eN\u003c/i\u003e cities of the \r\nMiddle-earth, numbered from 1 to \u003ci\u003eN\u003c/i\u003e (Rivendell has number 1), and comes back \r\nat the end of the journey. Nineteen years have passed since Bilbo\u0027s last \r\njourney, so he started to prepare for travelling. From his last journey Bilbo \r\nremembers that there is a warder at the entrance to each city. He asks the \r\ntravelers what city they came from and requires an entrance fare depending \r\non that. Time passed, and the entrance fee has changed since the last journey. \r\nFrom the King of Elves Elrond Bilbo has learnt that, if a traveler \r\narrives to a city with number \u003ci\u003eA\u003c/i\u003e from a city with number \u003ci\u003eB\u003c/i\u003e, the warder will \r\nrequire exactly \u003ci\u003eP\u003csub\u003eA\u003c/sub\u003e\u003c/i\u003e·[1000/\u003ci\u003eP\u003csub\u003eB\u003c/sub\u003e\u003c/i\u003e] gold coins, where \r\n\u003ci\u003eP\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e is the population of city with number \u003ci\u003ei\u003c/i\u003e and [\u003ci\u003eX\u003c/i\u003e] denotes \r\nthe floor of \u003ci\u003eX\u003c/i\u003e. Officials think that it will stimulate the population outflow from \r\nthe bigger cities to the smaller ones. Bilbo knows a population of all cities of \r\nMiddle-earth and supposes that it will not change during the year of his journey. \r\nAs usual, before the journey he would like to know the order of visiting the cities\r\nwhich will minimize the total amount of money paid.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains an integer \u003ci\u003eN\u003c/i\u003e. 2\u0026nbsp;≤\u0026nbsp;\u003ci\u003eN\u003c/i\u003e\u0026nbsp;≤\u0026nbsp;1000. The second line contains \r\n\u003ci\u003eN\u003c/i\u003e integers \u003ci\u003eP\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e, …, \u003ci\u003eP\u003csub\u003eN\u003c/sub\u003e\u003c/i\u003e, delimited with spaces\u0026nbsp;— the \r\npopulations of the cities of Middle-earth. All \u003ci\u003eP\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e lie in range from 1 to 1000.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOutput \u003ci\u003eN\u003c/i\u003e integers\u0026nbsp;— order of visiting \u003ci\u003eN\u003c/i\u003e cities \r\nwhich minimizes the total entrance fee. Remember that Bilbo starts his travel \r\nfrom the city with number 1, visits each city exactly once and returns to the \r\ncity with number 1 only in the end. If there are several solutions, you may \r\noutput any one of them.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","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\r\n10 3 5 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 4 2 3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}