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;
struct FASTINPUT {
  void f(string& s) {
    char buf[400005];
    long long a = scanf("%s", buf);
    a++;
    s = buf;
  }
  void f(long long& x) {
    long long a = scanf("%lld", &x);
    a++;
  }
  void f(int& x) {
    long long a = scanf("%d", &x);
    a++;
  }
  void f(double& x) {
    long long a = scanf("%lf", &x);
    a++;
  }
  template <typename A, typename B>
  void f(pair<A, B>& p) {
    f(p.first);
    f(p.second);
  }
  template <typename A>
  void f(vector<A>& x) {
    for (auto& y : x) f(y);
  }
  void read() {}
  template <typename Head, typename... Tail>
  void read(Head& H, Tail&... T) {
    f(H);
    read(T...);
  }
};
struct FASTOUTPUT {
  void f(string s) { printf("%s", s.c_str()); }
  void f(long long x) { printf("%lld", x); }
  void f(int x) { printf("%d", x); }
  void f(double x) { printf("%.20f", x); }
  void f(char x) { printf("%c", x); }
  void f(const char* a) { printf("%s", a); }
  void print() {}
  template <typename Head, typename... Tail>
  void print(Head H, Tail... T) {
    f(H);
    print(T...);
  }
};
struct DEBUG {
  string open = "[", close = "]", sep = ", ";
  string f(string s) { return s; }
  string f(char c) { return string(1, c); }
  string f(int x) { return to_string(x); }
  string f(long long x) { return to_string(x); }
  string f(double x) { return to_string(x); }
  string f(const char* a) { return a; }
  template <typename A, typename B>
  string f(pair<A, B> p) {
    return open + f(p.first) + sep + f(p.second) + close;
  }
  template <typename A>
  string f(A v) {
    string s = open;
    for (auto a : v) {
      if (s != open) {
        s += sep;
      }
      s += f(a);
    }
    s += close;
    return s;
  }
  void show() { cout << endl; }
  template <typename Head, typename... Tail>
  void show(Head H, Tail... T) {
    cout << " " << f(H);
    show(T...);
  }
};
vector<long long> di = {0, 0, 1, -1, 1, -1, 1, -1};
vector<long long> dj = {1, -1, 0, 0, -1, -1, 1, 1};
long long ob(long long i, long long n) { return i < 0 || i >= n; }
long long tp(long long x) { return (1LL << x); }
long long roundup(long long a, long long b) {
  return a % b ? a / b + 1 : a / b;
}
template <typename A, typename B>
long long exist(A a, B b) {
  return a.find(b) != a.end();
}
vector<string> ssplit(string s) {
  vector<string> ans;
  stringstream ss;
  ss << s;
  while (ss >> s) ans.push_back(s);
  return ans;
}
void makemod(long long& x, long long m) {
  x %= m;
  x += m;
  x %= m;
}
long long powmod(long long a, long long b, long long m) {
  if (b == 0) return 1;
  long long h = powmod(a, b / 2, m);
  long long ans = h * h % m;
  return b % 2 ? ans * a % m : ans;
}
bool isvowel(char ch) {
  ch = tolower(ch);
  return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
long long sign(long long x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }
void upmin(long long& x, long long v) { x = min(x, v); }
void upmax(long long& x, long long v) { x = max(x, v); }
const vector<long long> mods = {(long long)1e9 + 7, 998244353,
                                (long long)1e6 + 3, (long long)1e18 + 5};
const long long mod = mods[0];
const long long inf = mods[3];
const double eps = 1e-10;
const double pi = acos(0) * 2;
const string nl = "\n";
void solve() {
  long long n;
  do {
    FASTINPUT inp;
    inp.read(n);
  } while (false);
  vector<pair<long long, long long> > A(n);
  for (long long i = 0; i < n; i++) {
    do {
      FASTINPUT inp;
      inp.read(A[i].first);
    } while (false);
    A[i].second = i;
  }
  sort(A.rbegin(), A.rend());
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += A[i].first * i + 1;
  }
  do {
    FASTOUTPUT out;
    out.print(ans, nl);
  } while (false);
  for (long long i = 0; i < n; i++) do {
      FASTOUTPUT out;
      out.print(A[i].second + 1, ' ');
    } while (false);
  do {
    FASTOUTPUT out;
    out.print(nl);
  } while (false);
}
signed main() {
  long long t = 1;
  for (long long i = 0; i < t; i++) solve();
  return 0;
}