#include using namespace std; int m,ans; string expr; bool dp[3][1001][301]; int op1[2][1001][301],op2[2][1001][301]; char op[2][1001][301]; vector>chr[3][1001]; int expr1(int n); int term1(int n); int factor1(int n); void expr2(int n,int ans); void term2(int n,int ans); void factor2(int n,int ans); int expr1(int n){ auto&ch=chr[0][n]; ch.push_back({n,-1}); n=term1(n); ch.back().second=n; copy(dp[1][n],dp[1][n]+m+1,dp[0][n]); while(n=0){ dp[0][n][i-j]=1; op1[0][n][i-j]=i; op2[0][n][i-j]=j; op[0][n][i-j]='-'; } } } } return n; } int term1(int n){ auto&ch=chr[1][n]; ch.push_back({n,-1}); n=factor1(n); ch.back().second=n; copy(dp[2][n],dp[2][n]+m+1,dp[1][n]); while(n=1;i--){ term2(ch[i].first,op2[0][ch[i].second][ans]); expr[ch[i-1].second]=op[0][ch[i].second][ans]; ans=op1[0][ch[i].second][ans]; } term2(n,ans); } void term2(int n,int ans){ auto&ch=chr[1][n]; for(int i=ch.size()-1;i>=1;i--){ factor2(ch[i].first,op2[1][ch[i].second][ans]); expr[ch[i-1].second]=op[1][ch[i].second][ans]; ans=op1[1][ch[i].second][ans]; } factor2(n,ans); } void factor2(int n,int ans){ auto&ch=chr[2][n]; if(!ch.empty()) expr2(ch[0].first,ans); } int main(){ cin>>m>>ans>>expr; expr1(0); if(!dp[0][expr.size()][ans]){ cout<<-1<