#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n; string s(n+1,'$'); for(Int i=0;i>s[i]; s[n++]='+'; Int p=0,m=0; string t; for(char c:s){ if(c=='+') p++; if(c=='-') m++; if(isdigit(c)) t.push_back(c); } Int x=t.size(); const Int INF = 1e9; Int ma=-INF,mi=INF; for(Int k=0;k<2;k++){ if(k==0) sort(t.begin(),t.end()); if(k==1) sort(t.rbegin(),t.rend()); if(p){ string z=t; Int res=0; for(Int i=0;i