while~0: _="";a=raw_input().split('x');n=a.pop(0) for(e)in a:k=e>'^'and~-int(e[1]);_+="%+u"%(int(n)*-~k)+("x^%u"%k)[:k*k];n=e[2:] print _[_<'-':]
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page