Problem: Recently Vasya decided to improve his pistol shooting skills. Today his coach offered him the following exercise. He placed n cans in a row on a table. Cans are numbered from left to right from 1 to n. Vasya has to knock down each can exactly once to finish the exercise. He is allowed to choose the order in which he will knock the cans down.

Vasya knows that the durability of the i-th can is a_i. It means that if Vasya has already knocked x cans down and is now about to start shooting the i-th one, he will need (a_i ⋅ x + 1) shots to knock it down. You can assume that if Vasya starts shooting the i-th can, he will be shooting it until he knocks it down.

Your task is to choose such an order of shooting so that the number of shots required to knock each of the n given cans down exactly once is minimum possible.

Input

The first line of the input contains one integer n (2 ≤ n ≤ 1 000) — the number of cans.

The second line of the input contains the sequence a_1, a_2, ..., a_n (1 ≤ a_i ≤ 1 000), where a_i is the durability of the i-th can.

Output

In the first line print the minimum number of shots required to knock each of the n given cans down exactly once.

In the second line print the sequence consisting of n distinct integers from 1 to n — the order of indices of cans that minimizes the number of shots required. If there are several answers, you can print any of them.

Examples

Input


3
20 10 20


Output


43
1 3 2 


Input


4
10 10 10 10


Output


64
2 1 4 3 


Input


6
5 4 5 4 4 5


Output


69
6 1 3 5 2 4 


Input


2
1 4


Output


3
2 1 

Note

In the first example Vasya can start shooting from the first can. He knocks it down with the first shot because he haven't knocked any other cans down before. After that he has to shoot the third can. To knock it down he shoots 20 ⋅ 1 + 1 = 21 times. After that only second can remains. To knock it down Vasya shoots 10 ⋅ 2 + 1 = 21 times. So the total number of shots is 1 + 21 + 21 = 43.

In the second example the order of shooting does not matter because all cans have the same durability.

Solution (in PYTHON):

Solution:
import decimal,math
from collections import *
from fractions import gcd
from bisect import bisect_right,bisect_left
import sys

def primeFactors(n): 
	arr=[]
	while n % 2 == 0: 
		arr.append(2) 
		n = n / 2
	for i in xrange(3,int(math.sqrt(n))+1,2): 
		while n % i== 0: 
			arr.append(i) 
			n = n / i 
	if n > 2: 
		arr.append(n)
		# print n
	return arr	 

def SieveOfEratosthenes(n): 
	prime = [True for i in xrange(n+1)] 
	p = 2
	while (p * p <= n): 
		if (prime[p] == True): 
			
			for i in xrange(p * p, n+1, p): 
				prime[i] = False
		p += 1
	arr=[]
	for p in xrange(2, n): 
		if prime[p]: 
			arr.append(p)
	return arr

def invmod(i,mod):
	return pow(i,mod-2,mod)	
def fact(mod):
	fac= [1,1]
	ifac = [1,1]
	for i in xrange(2,(2500)):
		fac.append((fac[-1]*i)%mod)
		ifac.append((ifac[-1]*invmod(i,mod))%mod)
	return fac,ifac	
def divisors(n) : 
	list = []  
	for i in range(1, int(math.sqrt(n) + 1)) : 
		  
		if (n % i == 0) : 
			if (n / i == i) :
				list.append(i) 
			else : 
				list.append(i)
				list.append(int(n / i)) 
	list.sort()
	return list
				
def fi():
	return int(sys.stdin.readline())
 
def fi2():
	return map(int, sys.stdin.readline().split())
 
def fi3():
	return sys.stdin.readline().strip()
 
def fo(*args):
	for s in args:
		sys.stdout.write(str(s)+" ")
	sys.stdout.write("\n")
		
arr=[]

decimal.getcontext().prec = 15
l=fi()
arr = fi2()
c=[]
for i in range(len(arr)):
	c.append((arr[i],i))
c.sort()
c=c[::-1]
l=0
p=[]
for i in range(len(arr)):
	l=l+(c[i][0]*i+1)
	p.append(c[i][1]+1)
print l			
fo(*p)