#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 150;
const int inf = 0x7f7f7f7f;
int n;
int a[N*2],f[N][N][3],ans;
char op[N*2];
int main()
{
cin>>n;
for(int i=1;i<=n;++i){
cin>>op[i]>>a[i];
a[i+n]=a[i];
op[i+n]=op[i];
}
for(int i=1;i<=2*n;++i)
for(int j=1;j<=2*n;++j) f[i][j][0]=-inf,f[i][j][1]=inf;
for(int i=1;i<=2*n;++i) f[i][i][0]=f[i][i][1]=a[i];
for(int len=2;len<=n;++len){
for(int i=1,j=len;j<=2*n;i++,j++){
for(int k=i;k<j;++k){
if(op[k+1]=='x'){//在存储的时候,是先存边在存点的,所以要 +1
f[i][j][0]=max(f[i][j][0],max(f[i][k][0]*f[k+1][j][0],max(f[i][k][1]*f[k+1][j][1],max(f[i][k][0]*f[k+1][j][1],f[i][k][1]*f[k+1][j][0]))));
f[i][j][1]=min(f[i][j][1],min(f[i][k][1]*f[k+1][j][1],min(f[i][k][0]*f[k+1][j][0],min(f[i][k][0]*f[k+1][j][1],f[i][k][1]*f[k+1][j][0]))));
}
else {
f[i][j][0]=max(f[i][j][0],f[i][k][0]+f[k+1][j][0]);
f[i][j][1]=min(f[i][j][1],f[i][k][1]+f[k+1][j][1]);
}
}
}
}
for(int i=1;i<=n;++i) ans=max(ans,f[i][i+n-1][0]);
printf("%d\n",ans);
for(int i=1;i<=n;++i)
if(f[i][i+n-1][0]==ans) printf("%d ",i);//只要 f[i][i+n-1][0]==ans,就说明以 i为第一条删的边的策略可以达到最大值,所以直接输出 i就行了
return 0;
}