#include<bits/stdc++.h>
using namespace std;
long long int sum,mid;
int n;
stack<int>ms;
int a[10000001];
void rec(int i,long long int ls,stack<int>s)
{
    if(i>=n-1)return;
    for(int j=i+1;j<n;j++)
    {
        ls+=a[j];
        s.push(j);
        if(mid>max(ls,sum-ls)-min(ls,sum-ls))
        {
            mid=max(ls,sum-ls)-min(ls,sum-ls);
            ms=s;
        }
        rec(j,ls,s);
        s.pop();
        ls-=a[j];
    }
}
int used[10000001];
vector<int>solve(vector<int>A)
{
    n=A.size();
    sum=0;
    for(int i=0;i<n;i++)
    {
        a[i]=A[i];
        sum+=a[i];
    }
    mid=sum;
    for(int i=0;i<n;i++)
    {
        stack<int>s0;
        rec(i,0,s0);
    }
    vector<int>ans,ans1;
    long long int s1=0;
    int sz=ms.size();
    for(int i=0;i<sz;i++)
    {
        ans1.push_back(ms.top());
        s1+=a[ms.top()];
        used[ms.top()]=1;
        ms.pop();
    }
    if(s1>=sum-s1)
    {
        //cout<<1<<endl;
        ans=ans1;
        for(int i=0;i<n;i++)
        {
            if(used[i]==0)ans.push_back(i);
        }
    }
    else
    {
        //cout<<2<<endl;
        for(int i=0;i<n;i++)
        {
            if(used[i]==0)ans.push_back(i);
        }
        for(int i=0;i<sz;i++)
        {
            ans.push_back(ans1[i]);
        }
    }
    memset(used,0,sizeof(used));
    memset(a,0,sizeof(a));
    return ans;
}
