typedef struct{int r,i;}C;char*p,s[999];o;C E(),M(),a;C G(r,i){C c={r,i};o|=abs(r)>1e4||abs(i)>1e4;return c;}C T(l){C c;*p==40?c=E(p++),p++:*p<58?c.i=!sscanf(p,"%d%n",&c.r,&l),p+=l:(c=G(0,1),p++);return c;}C E(f){C c=M(),d;for(f=1;f;)f=*p==43?d=M(p++),c=G(c.r+d.r,c.i+d.i),1:*p==45?d=M(p++),c=G(c.r-d.r,c.i-d.i),1:0;return c;}C M(f){C c=T(),d;for(f=1;f;)f=*p==42?d=T(p++),c=G(c.r*d.r-c.i*d.i,c.r*d.i+c.i*d.r),1:0;return c;}main(){for(;~scanf("%s",p=s);o?o=!puts("overflow"):a.i?a.r?printf("%d%+di\n",a.r,a.i):printf("%di\n",a.i):printf("%d\n",a.r))a=E();}