#include <bits/stdc++.h>
using namespace std;
int BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (int)R;
}
long long ncr(long long a, long long b) {
  long long res = 1;
  b = max(b, a - b);
  for (long long i = b + 1, j = 1; i <= a; i++, j++) res = ((res * i) / j);
  return res;
}
long long npr(long long a, long long b) {
  long long res = 1;
  for (long long i = a - b + 1; i <= a; i++) res *= i;
  return res;
}
string decimal_to_binary(long long cur) {
  string v;
  while (cur) {
    v.push_back((cur % 2) + '0');
    cur /= 2;
  }
  return v;
}
long long lcm(long long x, long long y) {
  long long r;
  return ((r / x) * y);
}
long long power(long long a, long long b) {
  long long ans = 1;
  for (int i = 0; i < b; i++) ans *= a;
  return ans;
}
long long vagerMod(long long a, long long b, long long mm) {
  return ((a % mm) * (BigMod(b, mm - 2, mm))) % mm;
}
long long arrToNumberOfDigits[] = {
    9,
    9 + 90 * 2,
    9 + 90 * 2 + 900 * 3,
    9 + 90 * 2 + 900 * 3 + 9000 * 4,
    9 + 90 * 2 + 900 * 3 + 9000 * 4 + 90000 * 5,
    9 + 90 * 2 + 900 * 3 + 9000 * 4 + 90000 * 5 + 900000 * 6,
    9 + 90 * 2 + 900 * 3 + 9000 * 4 + 90000 * 5 + 900000 * 6 + 9000000 * 7,
    9 + 90 * 2 + 900 * 3 + 9000 * 4 + 90000 * 5 + 900000 * 6 + 9000000 * 7 +
        90000000 * 8};
pair<long long, long long> MV(long long a, long long b, long long c,
                              long long d) {
  pair<long long, long long> aa;
  aa.first = c - a;
  aa.second = d - b;
  return aa;
}
long long CP(long long a, long long b, long long c, long long d) {
  return (a * d - b * c);
}
string cut_leading_zero(string a) {
  string s;
  int i;
  if (a[0] != '0') return a;
  for (i = 0; i < (int)a.size() - 1; i++)
    if (a[i] != '0') break;
  for (i = i; i < (int)a.size(); i++) s += a[i];
  return s;
}
long long T, C = 1, N;
bool comp(pair<pair<long long, long long>, long long> a,
          pair<pair<long long, long long>, long long> b) {
  return a.second > b.second;
}
void process() {
  long long arr[103];
  long long n;
  vector<pair<pair<long long, long long>, long long> > v;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      if (arr[i] == arr[j]) {
        long long sum = arr[i] + arr[j];
        for (long long k = i + 1; k < j; k++) {
          if (arr[k] > 0) sum += arr[k];
        }
        v.push_back(make_pair(make_pair(i, j), sum));
      }
    }
  }
  sort(v.begin(), v.end(), comp);
  int ct = 0 + v[0].first.first + n - v[0].first.second - 1;
  for (int i = v[0].first.first + 1; i < v[0].first.second; i++) {
    if (arr[i] < 0) ct++;
  }
  cout << v[0].second << " " << ct << endl;
  for (int i = 0; i < v[0].first.first; i++) cout << i + 1 << " ";
  for (int i = v[0].first.first + 1; i < v[0].first.second; i++)
    if (arr[i] < 0) cout << 1 + i << " ";
  for (int i = v[0].first.second + 1; i < n; i++) cout << 1 + i << " ";
  return;
}
int main() {
  process();
  return 0;
}
