import std.stdio,std.c.stdlib;void main(){char[99]s;char*p;real n,m;for(int x;gets(p=&*s);puts=&*"0"+x)for(x=0;*p;x=n?printf(&*(!--m||n+1?!m||n-1?x?"%+Lg":"%Lg":"":"-"),n),printf(&*(m?m-1?"x^%Lg":"x":""),m),1:x)n=*p>99?1:*p<46&p[1]>99?44-*p++:strtold(p,&p),n*=m=*p>99?*++p>93?strtold(++p,&p):1:0;}