#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll INF = LLONG_MAX/3;
using P = pair<ll,int>;

const int N = 4004;

struct SegTree{
    int n; vector<P> dat;
    //初期化
    SegTree(int _n){
        n=1;
        while(n<_n) n*=2;
        dat=vector<P>(2*n-1,{INF,N});
    }
    //k番目(0-indexed)の値をaに更新
    void update_min(int k, ll a, int idx){
        // printf("  UPD: %d %lld\n",k,a);
        k+=n-1;
        dat[k] = min(dat[k], {a,idx});
        //更新
        while(k>0){
            k=(k-1)/2;
            dat[k]=min(dat[2*k+1],dat[2*k+2]);
        }
    }
    //内部的に投げられるクエリ
    P _query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return {INF,N};
        if(a<=l && r<=b) return dat[k];

        P vl=_query(a,b,2*k+1,l,(l+r)/2);
        P vr=_query(a,b,2*k+2,(l+r)/2,r);
        return min(vl,vr);
    }
    //[a,b)
    P query(int a, int b){
        return _query(a,b,0,0,n);
    }
};

ll dp[N][N];
int par[N][N];

int main(){
    int n;
    scanf(" %d", &n);
    vector<ll> a(n);
    rep(i,n) scanf(" %lld", &a[i]);

    vector<ll> s(n+1);
    for(int i=1; i<=n; ++i) s[i] = s[i-1]+a[i-1];

    fill(dp[0],dp[N],INF);
    dp[0][0] = -INF;

    fill(par[0],par[N],-1);

    for(int i=1; i<=n; ++i){

        vector<ll> v;
        rep(j,n+1){
            v.pb(s[j] + dp[i-1][j]);
        }
        sort(all(v));
        v.erase(unique(all(v)), v.end());
        // dbg(v);

        int V = v.size();
        SegTree st(V);

        rep(j,n+1){
            int idx = lower_bound(all(v), s[j]) - v.begin();
            P res = st.query(0,idx);
            // dbg(res);
            if(res.fi < INF && dp[i][j] > s[j] + res.fi){
                dp[i][j] = s[j] + res.fi;
                par[i][j] = res.se;
            }

            int uidx = lower_bound(all(v), s[j]+dp[i-1][j]) - v.begin();
            st.update_min(uidx, -s[j], j);

            // printf(" %d: idx %d  uidx %d\n",j,idx,uidx);
        }

        // printf(" --------- i %d\n",i);
        // rep(j,n+1) printf(" dp %d  %lld  , par %d\n",j,dp[i][j],par[i][j]);
    }

    int m = 0;
    rep(i,n+1){
        if(dp[i][n] < INF) m = i;
    }

    int now = n;
    vector<int> ans;
    rep(i,m-1){
        now = par[m-i][now];
        ans.pb(now);
        // printf("%d\n", now);
    }

    reverse(all(ans));

    printf("%d\n", m);
    rep(i,m-1) printf("%d%c", ans[i], " \n"[i==m-2]);
    return 0;
}


### Prompt

Develop a solution in Cpp to the problem described below:

Time passed and Taro became a high school student. Under the influence of my older brother who was a college student, I began to be interested in computer science. Taro read through computer science textbooks and learned that there was a famous problem called the "longest increase subsequence problem." Taro understood this problem, but was wondering if he could create a similar problem himself. Therefore, Taro created the following problem as a result of trial and error.

* There is a sequence A consisting of n integers
* Decompose the sequence A into m sequences with m-1 delimiters. In addition, each sequence after decomposition must always include one or more numbers.
* If the m numbers created by adding all the integers in each of these m sequences are arranged in the order of the original sequence, it becomes a strict increasing sequence (that is, the resulting sequence is Bi <Bi + 1). I want to do it.
* The goal is to maximize the length m of the final sequence B.



For example, consider the case where the sequence A is {5, -4,10, -3,8}.
Prepare a sequence C that represents the position of the delimiter, and set C = {2,4}.
At this time, the sequence A is divided into the parts (5, -4), (10, -3), (8), and when these interiors are added together, they become 1,7,8, respectively, and the resulting sequence B is {1, 7,8}.

<image>

Taro named this problem the "longest increase subsequence problem" and also considered an algorithm to solve it.
And I contacted you as a member of society to check it. Your job is to create a program to solve the problems created by Taro who has grown up.
Since it is my job to check, it also outputs the position of the m-1 delimiter. In addition, there may be multiple such delimiters for the optimum m, but if this m is output correctly, one of the possible ones should be output.

Constraints

> 1 ≤ n ≤ 4000
> | Ai | ≤ 108
>

* For the integer k, | k | represents the absolute value of k

Input

N + 1 integers are given, separated by line breaks.

> n
> A1
> A2
> ...
> An
>

* n represents the length of the given sequence A
* Ai represents the i-th element of the sequence A.

Output

> m
> C1 C2 .. Cm-1
>

* The first line outputs one integer m. m represents the length of the final sequence B. The second line outputs m-1 integer Ci separated by blanks. Ci represents the i-th delimiter when the sequence A is appropriately divided into m parts. See the figure for the definition of the delimiter. Note that 1 ≤ Ci <n is satisfied. The m-1 integer sequence C in the second row must be arranged in ascending order. Therefore, if i <j, then Ci <Cj holds.


* If m = 1, the second line will be blank.
* When the sequence B is generated from the sequence A according to the sequence C, when the sequence B is not an increasing sequence (that is, when i (1 ≤ i <m) such that Bi ≥ Bi + 1 exists), it becomes WrongAnswer.

Examples

Input

3
1
2
4


Output

3
1 2


Input

3
2
2
2


Output

2
1


Input

3
4
2
1


Output

1
(空行)

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll INF = LLONG_MAX/3;
using P = pair<ll,int>;

const int N = 4004;

struct SegTree{
    int n; vector<P> dat;
    //初期化
    SegTree(int _n){
        n=1;
        while(n<_n) n*=2;
        dat=vector<P>(2*n-1,{INF,N});
    }
    //k番目(0-indexed)の値をaに更新
    void update_min(int k, ll a, int idx){
        // printf("  UPD: %d %lld\n",k,a);
        k+=n-1;
        dat[k] = min(dat[k], {a,idx});
        //更新
        while(k>0){
            k=(k-1)/2;
            dat[k]=min(dat[2*k+1],dat[2*k+2]);
        }
    }
    //内部的に投げられるクエリ
    P _query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return {INF,N};
        if(a<=l && r<=b) return dat[k];

        P vl=_query(a,b,2*k+1,l,(l+r)/2);
        P vr=_query(a,b,2*k+2,(l+r)/2,r);
        return min(vl,vr);
    }
    //[a,b)
    P query(int a, int b){
        return _query(a,b,0,0,n);
    }
};

ll dp[N][N];
int par[N][N];

int main(){
    int n;
    scanf(" %d", &n);
    vector<ll> a(n);
    rep(i,n) scanf(" %lld", &a[i]);

    vector<ll> s(n+1);
    for(int i=1; i<=n; ++i) s[i] = s[i-1]+a[i-1];

    fill(dp[0],dp[N],INF);
    dp[0][0] = -INF;

    fill(par[0],par[N],-1);

    for(int i=1; i<=n; ++i){

        vector<ll> v;
        rep(j,n+1){
            v.pb(s[j] + dp[i-1][j]);
        }
        sort(all(v));
        v.erase(unique(all(v)), v.end());
        // dbg(v);

        int V = v.size();
        SegTree st(V);

        rep(j,n+1){
            int idx = lower_bound(all(v), s[j]) - v.begin();
            P res = st.query(0,idx);
            // dbg(res);
            if(res.fi < INF && dp[i][j] > s[j] + res.fi){
                dp[i][j] = s[j] + res.fi;
                par[i][j] = res.se;
            }

            int uidx = lower_bound(all(v), s[j]+dp[i-1][j]) - v.begin();
            st.update_min(uidx, -s[j], j);

            // printf(" %d: idx %d  uidx %d\n",j,idx,uidx);
        }

        // printf(" --------- i %d\n",i);
        // rep(j,n+1) printf(" dp %d  %lld  , par %d\n",j,dp[i][j],par[i][j]);
    }

    int m = 0;
    rep(i,n+1){
        if(dp[i][n] < INF) m = i;
    }

    int now = n;
    vector<int> ans;
    rep(i,m-1){
        now = par[m-i][now];
        ans.pb(now);
        // printf("%d\n", now);
    }

    reverse(all(ans));

    printf("%d\n", m);
    rep(i,m-1) printf("%d%c", ans[i], " \n"[i==m-2]);
    return 0;
}


```