#include <bits/stdc++.h>
using namespace std;
int A[200];
bool has[200];
int main() {
  int N;
  while (cin >> N) {
    for (int i = 0; i < N; i++) cin >> A[i];
    long long int maxi = 0;
    long long int cnt = 0;
    vector<int> ans, tmp;
    bool fs = true;
    for (int i = 0; i < N - 1; i++)
      for (int j = i + 1; j < N; j++) {
        if (A[i] == A[j]) {
          cnt = 0;
          tmp.clear();
          for (int k = i; k <= j; k++) {
            if (A[k] > 0 || k == i || k == j) {
              tmp.push_back(k);
              cnt += A[k];
            }
          }
          if (cnt > maxi || fs) {
            ans.assign(tmp.begin(), tmp.end());
            maxi = cnt;
            fs = false;
          }
        }
      }
    cout << maxi << " " << N - ans.size() << endl;
    memset(has, false, sizeof has);
    for (int i = 0; i < ans.size(); i++) has[ans[i]] = true;
    for (int i = 0; i < N; i++)
      if (has[i] == false) cout << i + 1 << " ";
  }
  return 0;
}
