#include <bits/stdc++.h>
int main() {
  long long int i, n, k = 0, ans, j, a[101] = {0}, p[101][4] = {0}, l = 0,
                      ind[101], f = 0, max, t, cut = 0, min;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (i = 0; i < n; i++) {
    f = 0;
    for (j = i + 1; j < n; j++) {
      if (a[i] == a[j]) {
        p[k][0] = i;
        p[k][1] = j;
        f = -1;
        p[k][2] = 0;
      }
    }
    if (f == -1) {
      k++;
    }
  }
  j = 0;
  l = 0;
  for (; j < k; j++) {
    for (t = p[j][0]; t <= p[j][1]; t++) {
      if (t > p[j][0] && t < p[j][1] && a[t] < 0) {
        p[j][3]++;
      } else {
        p[j][2] += a[t];
      }
    }
  }
  max = p[0][2];
  for (i = 0; i < k; i++) {
    if (p[i][2] > max) {
      max = p[i][2];
      ans = i;
    }
  }
  cut = n - p[ans][1] + p[ans][0] - 1;
  printf("%lld", p[ans][2]);
  printf(" ");
  printf("%lld", cut + p[ans][3]);
  printf("\n");
  for (i = 0; i < n; i++) {
    if (i < p[ans][0] || i > p[ans][1]) {
      printf("%lld", i + 1);
      printf(" ");
    } else {
      if (a[i] < 0 && i != p[ans][0] && i != p[ans][1]) {
        printf("%lld", i + 1);
        printf(" ");
      }
    }
  }
  return 0;
}
