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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void swap(long long &a, long long &b) {
  a = a ^ b;
  b = a ^ b;
  a = a ^ b;
}
bool odd(long long n) { return n & 1; }
long long powerof2(long long k) { return (1 << k); }
bool getbit(long long n, long long k) { return n & (1 << (k - 1)); }
void makesetbit(long long &n, long long &k) {
  int t = getbit(n, k);
  if (t)
    return;
  else
    n = n ^ (1 << (k - 1));
}
void makesetunbit(long long &n, long long k) {
  int t = getbit(n, k);
  if (t) n = n ^ (1 << (k - 1));
}
void sieve(set<long long int> &s, vector<bool> &arr) {
  for (int i = 4; i < 10000000001; i += 2) {
    arr[i] = false;
  }
  for (long long int i = 3; i * i < 10000000001; i += 2) {
    if (arr[i] == true) {
      for (long long int j = i * i; j <= 1000000001; j += i) arr[j] = false;
    }
  }
  s.insert(2);
  for (long long int i = 3; i * i < 1000000001; i += 2) {
    if (arr[i]) s.insert(i);
  }
}
bool o(int k, int b) {
  while (k > 0) {
    if (k % 10 == b) return true;
    k /= 10;
  }
  return false;
}
set<int> v;
void squares() {
  for (int i = 1; i < 101; i++) {
    v.insert(i * i);
  }
}
vector<long long> vl;
vector<long long> first(long long *a, long long s, long long n, long long x) {
  static long long index = 0;
  if (a[s] == x) vl.push_back(n - index);
  if (s == 0) return vl;
  index++;
  return first(a, s - 1, n, x);
}
int lengthofstring(string s, long long start) {
  if (s[start] == '\0') return 0;
  return 1 + lengthofstring(s, start + 1);
}
void removeX(char s[]) {
  if (s[0] == '\0') return;
  if (s[0] != 'x')
    removeX(s + 1);
  else {
    long long i;
    for (i = 1; s[i] != '\0'; ++i) {
      s[i - 1] = s[i];
    }
    s[i - 1] = s[i];
    removeX(s);
  }
}
void removedupli(char s[]) {
  if (s[0] == '\0' || s[1] == '\0') return;
  if (s[0] != s[1])
    removedupli(s + 1);
  else {
    long long i;
    for (i = 1; s[i] != '\0'; ++i) {
      s[i - 1] = s[i];
    }
    s[i - 1] = s[i];
    removedupli(s);
  }
}
long long fact(long long a) {
  if (a == 0) return 1;
  return a * fact(a - 1);
}
int divide(long long a, long long b) {
  if (a < b) return 1;
  if (a == b) return 2;
  int ans = divide(a / b, b);
  int an = divide(a, b++);
  return 1 + min(an, ans);
}
long long sumof(long long a) {
  long long sum = 0;
  while (a > 0) {
    sum += a % 10;
    a /= 10;
  }
  return sum;
}
bool compare(string a, string b) { return a.length() < b.length(); }
long long med(vector<long long> arr, long long k) {
  sort(arr.begin(), arr.end(), greater<long long>());
  if (k & 1) return arr[(k - 1) / 2];
  return arr[(k + 1) / 2];
}
bool compo(pair<int, int> arr, pair<int, int> brr) {
  return arr.first > brr.first;
}
string binary(int n) {
  string s = "";
  while (n > 0) {
    s += to_string(n % 2);
    n /= 2;
  }
  return s;
}
int returnf(long long a, int b) {
  int count = 0, m = b;
  while (a > b) {
    b *= m;
    count++;
  }
  return count;
}
bool pairs(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
long long cnt = 0;
long long sum(long long n) {
  long long sums = 0;
  while (n > 0) {
    sums += (n % 10);
    n /= 10;
  }
  return sums;
}
void solve() {
  long long n;
  cin >> n;
  vector<pair<int, int>> arr;
  long long a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    arr.push_back(make_pair(a, i));
  }
  sort(arr.begin(), arr.end(), compo);
  long long x = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (arr[i].first * x + 1);
    x++;
  }
  cout << sum << '\n';
  for (int i = 0; i < n; i++) cout << arr[i].second + 1 << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}