#include using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef long long ll; typedef vector vl; typedef vectorvvl; typedef vectorvvvl; typedef vectorvvvvl; typedef vectorvvvvvl; typedef vectorvi; typedef vectorvvi; typedef vectorvvvi; typedef vectorvvvvi; typedef vectorvvvvvi; typedef pair P; #define debug(v) cout<<#v<<":";for(auto x:v){cout< struct Parser{ bool error;// ヤバイ時trueに Parser():error(false){} // 四則演算 T expression(string &s,int &p){ vl vec; if(s[p]=='d'){ vec=factor(s,p); } else { // cout<=1;i--){ vec[i]=vec[i-1]; } vec[0]=0; } else { rep(i,11)vec[i]*=s[p]-'0'; } p++; continue; } break; } // debug(vec); return vec; } // d{} or x*x+3 T factor(string &s,int &p){ T res(11); if(s[p]=='d'){ p+=2; vl vec=factor(s,p); rep(i,10)res[i]=vec[i+1]*(i+1); p++; }else{ return expression(s,p); } return res; } // 数,intのみならこれでいい. // int以外の数を受け取る場合は適宜編集すること // T number(string &s,int &p){ // T vec(11); // if(isdigit(s[p])); // else { // vec[0]= // } // return res; // } T execute(string &s){ int p=0; error=false; return expression(s,p); } }; int main(){ //サイズ11のvectorで表す ll a,b;cin>>a>>b; Parserps; string s;cin>>s; vl vec=ps.execute(s); rep(i,b+1){ cout<